2796 - I2P(II) 2023_Kuo_Midterm2 Scoreboard

Time

2023/05/09 12:50:00 2023/05/09 15:10:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team
1 13184 - Twenty One - It's free to come in KuoTA Compiler Please select at least C++11 KuoTA 2023/05/09 14:20:11

12534 - I'm reference   

Description

Download the C++ reference.
You will see the file named "12534.cpp" but that's OK.
Just download the file and change the filename extension(副檔名) into "zip" then you can upzip the file and use the reference.
The link is below.

reference.zip

Input

Output

Sample Input  Download

Sample Output  Download

Partial Judge Code

12534.cpp

Partial Judge Header

12534.h

Tags




Discuss




13163 - KYてぇてぇ — Birthday Present(class)   

Description

Kuo-chan is given a sequence A and a constant K as his birthday present from Yang-chan.

Kuo-chan is allowed to perfrom the following operation:

  1. push x — push x to the end of A
  2. pop — remove the median value of A (the median value of A is A[ (|A|+1)/2 ])
  3. programming tanoshi — for 1 <= i <= |A|, assign A[ i ] % K to A[ i ]

 

For example, if A = [4, 3, 5], K = 2

push 11 ► A = [4, 3, 5, 11]

pop ► A = [4, 5, 11]

pop ► A = [4, 11]

programming tanoshi ► A = [0, 1] 

 

Yang-chan is curious about what A is after Kuo-chan performs some operations to it.

Help him find it out!

Input

The first line contains three integers N K Q — the length of A, the constant Yang-chan gives Kuo-chan, the number of operations Kuo-chan performs.

The second line contains N integers a1, a2, ..., aN (1 <= ai <= N) — the elements of A. 

Each of the next Q lines describes the operations. Each line is one of three types:

  1. push x (1 <= x <= N)
  2. pop
  3. programming tanoshi

 

Different testcases have different constraints.

  1. N <= 103, Q <=   N, K <= N, operations: {pop}
  2. N <= 103, Q <= 2N, K <= N, operations: {pop, push}
  3. N <= 103, Q <= 2N, K <= N, operations: {pop, push, programming tanoshi}
  4. N <= 105, Q <=   N, K <= N, operations: {pop}
  5. N <= 105, Q <= 2N, K <= N, operations: {pop, push}
  6. N <= 105, Q <= 2N, K <= N, operations: {pop, push, programming tanoshi}

Output

You should print one line containing the elements of A after the operations. For 1 <= i <= |A|, the i-th number should be A[ i ].

Sample Input  Download

Sample Output  Download

Partial Judge Code

13163.cpp

Partial Judge Header

13163.h

Tags




Discuss




13184 - Twenty One - It's free to come in   

Description

After watching the movie 21, Kuo is curious about casino.

 

There is a casino which opens N days in this month.

There will be two kind of events in a day.

  1. Guest <Someone> <Money> <Skill>. It means <Someone> enter the casino with <Money> money. <Someone> are their names, <Money> is the amount of money with them, and <Skill> is how well they play. If <Someone> are already in the casino or are blacklisted, ignore this event.
  2. Win <Someone> <Money>. It means <Someone> win <Money> money in a play from the casino. <Money> may be positive or negative. If <Someone> are not in the casino or are blacklisted, ignore this event.

 

Whenever one become bankrupt, they will be kicked out of the casino and be blacklisted.

If the amout of money someone win in a play exceed (that is, >) twice of their <Skill>, they will be seen as cheaters, kicked out of the casino, and blacklisted. (The casino still has to pay the money they win to them.)

Someone blacklisted are not permitted to enter the casino.

Note: If someone have to pay X money but they only have Y money where Y <= X, they will only pay Y money and become bankrupt.

At the end of each day, everyone will leave the casino.

 

Please help Kuo-chan find how much income the casino gets in this month and who are blacklisted.

Input

The first line of the input contains a number — the number of days in this month.

The following contains blocks.

The first line of each block is Casino Q — it means there will be events this day.

The next lines is one of the following:

  1. Guest <Someone> <Money> <Skill>
  2. Win <Someone> <Money>

 

N <= 1000, Q <= 100. 

There will be at most 1000 different people come to the casino; that is, there are at most 1000 people with different names. Therefore, there will be at most 1000 people blacklisted.

All number is within the range of int.

Output

You should print a number in the first line — how much income the casino gets in this month.

If there are people blacklisted in this month, you should output their names in lines in the order they get blacklisted.

Sample Input  Download

Sample Output  Download

Partial Judge Code

13184.cpp

Partial Judge Header

13184.h

Tags




Discuss




13893 - Polynomial Calculator 2   

Description

Warning: In Funciton::parse, the use of atoi for parsing constants makes the calculation different from what you'd get with a normal calculator, since atoi always returns an integer. Therefore, the testcases will be different than what you expect. Sorry for the confusion.

Most of the problem are as same as Polynomial Calculator (https://acm.cs.nthu.edu.tw/problem/13890/), the only difference is that you think if a calculator can only calculate f(x) is too weak, so you decide to add a function: differential.

There is one more function in class Function:

Function *differential(): this is used to return the differential function, and it needs all its derived class to override it.

Differential Formula:

 

 

Please paste the following code after the code you write, and don't forget to include "function.h"!

Function* Function::parse(stringstream &ss){
    string s;
    ss >> s;
    if(s == "+" || s == "-" || s == "*" || s == "/"){
        Function *a = parse(ss), *b = parse(ss);
        Function *now = Arithmetic::create(a, s[0], b);
        return now;
    }else if(s[0] == 'x'){
        Function *now = Variable::create(s);
        return now;
    }else if(s == "**"){
        Function *a = parse(ss), *b = parse(ss);
        Function *now = Polynomial::create(a, b);
        return now;
    }else if(s == "sin"){
        Function *a = parse(ss);
        Function *now = Sin::create(a);
        return now;
    }else if(s == "cos"){
        Function *a = parse(ss);
        Function *now = Cos::create(a);
        return now;
    }else{
        Function *now = Constant::create(atoi(s.c_str()));
        return now;
    }
}

 

Input

The first line contains a preordered polynomial f(x):

  • Constants and Variable: constant value or variable x, ex. x, 5.3, 7
  • Polynomial operator: ** a b, represent ab, it's guarantee no x in b
  • Arithmetic operator: op a b, represent a op b, ex. + 5 x means 5 + x. op constains only + - * /
  • Trignomotric operator: op a, represent op(a), ex. sin x means sin(x). op contains only sin and cos

The second line contains an integer Q, means the number of queries.

The following Q lines are the queries, each line contains an integer x.

The length of the first line won't exceed 1e6, and 1 <= Q <= 2e5.

Each constant and query is between [-100, 100]. It's guarantee that no overflow and divided by 0

Output

For each x, please output the answer of f(x) and f'(x).

Sample Input  Download

Sample Output  Download

Partial Judge Code

13893.cpp

Partial Judge Header

13893.h

Tags




Discuss




13905 - Example Partial Problem   

Description

In this Problem, we are going to learn how to write partial judge problem.

We will use Code::Blocks to demonstrate

Create New Project

First, create a new project (go to File->New->Project)

 

Select Console Application and go

 

Select a language you should be using

 

Name the project, and select where to store it

 

Usually you do not need to change anything here, just click Finish

Now you have create a project

 

Import Files

Now we have to add files into the project, to let codeblocks know which files to compile

Choose Add files... in the Project tab

 

Add the files you downloaded from the Online Judge (remember to rename header file to function.h)

 

And OK

 

And you should see the files in their respective folders in the bar on the left hand side (main.cpp is the default file created when you created a project)

 

Write Code

Search for the functions you have to write (usually in function.h).

For example, in this problem, you will have to implement these 4 functions: setScore(int), setName(string), getScore(), getName()

 

IMPORTANT: Do not implement the functions in header, or copy the whole header to another file (you will see why later)

Instead, create a new cpp file, and write the implementation there. Remember to #include "function.h"

For example, writing a class function, the format should be [type] [class]::[function name]

 

After you finished, you can press build and run as usual, and it should work

 

Submit

To submit the code to Online Judge, just select all the code you wrote in the cpp files, and copy-paste it to the Submit section (no deleting or commenting needed)

 

Open a Project

To open a project that is already created, select File->Open...

 

Find the .cbp file, it should be at the place you chose when you were naming the project

 

Another way 

1. copy the h file to the cpp file

2. write until the cpp can work 

3. copy the upper part from the top until the original c++ part 

4. Submit 

Input

Given an integer, then a string

Output

Output a string, then an integer

Sample Input  Download

Sample Output  Download

Partial Judge Code

13905.cpp

Partial Judge Header

13905.h

Tags

tag



Discuss




13909 - I2P(II) 2023_Kuo_Midterm2_rule   

Description

  1. Only C and C++ are allowed. Solving problems with other languages (e.g. python, java) are forbidden, otherwise you'll get zero point.

  2. Paper references, electronic devices, or other items that may contain any information relative to this exam are not allowed.

  3. Before leaving, please tell TAs, we'll check if your accepted / partially accepted submissions are all written in C  or C++. After you pass the check, you may sign your name as a record and leave.

  4. The score of each problem is shown below:

    • 13163: 33.3 points

    • 13184: 33.3 points

    • 13893: 33.3 points

If you get partially correct in a problem, your score of the problem will be

  • score of the problem * number of testcases you passed / number of testcases

For example, if score of a problem is 10 points and the problem contains 6 testcases. If you pass the 3 testcases, you'll get 10*3/6=5 points on this problem.

Input

Output

Sample Input  Download

Sample Output  Download

Tags




Discuss