1857 - I2P(II) 2019_Fall_Chen_practice5 Scoreboard

Time

2019/12/05 18:00:00 2019/12/12 18:00:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
12536 People nowadays
12541 Vector Implementation
12543 Endgame

12536 - People nowadays   

Description

You are going to maintain a data structure that each element is a person described by a string of name and int of age.

Give you n orders. There're four types of order

born:

The order will followed by a string and a int represented a person's name and age. Insert the new person into the set.

find:

The order will followed by a string and a int. Find out if the person exist in the set or not. If the person exist, print YES, else print NO.

kill

The order will followed by a string and a int. Erase the person from the set.

If you can't find the person, do nothing.

young:

Print the youngest person in the set. If multiple people has the same age, print the person whose name is the smallest lexicographical order.

If you can't find the person, do nothing.

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

The first line contains only one integer n(1 <= n <= 200000)

The following n lines each lines contains order as the description described.

Each name's length will not exceed 10000.

Each age is in rage of  int

Output

For each order print as demand.

Remember to print \n at the end of each output.

Sample Input  Download

Sample Output  Download

Tags




Discuss




12541 - Vector Implementation   

Description

No memes, stories, jokes, or javascript that makes the problem disappears, yay o(* ̄▽ ̄*)o


This problem is partial judge. And you are going to implement a vector by yourself.

Things you need to implement:

  • vector(): Constructor of our vector. CAPACITY and SIZE are initially 0.

  • void push_back(T x): Same as push_back function in STL. Note that if CAPACITY equals to SIZE, you have to double the size of arr first, then push element in.

  • T & operator [] (const int &x): Random access, same as STL. A vector<int> V should be able to access every element of arr by calling V[x].

  • const T & operator [] (const int &x) const: Random access for any constant object.

  • size_t size(): Same as size function in STL. Return the size of the vector.

  • size_t capacity(): Same as capacity function in STL. Return the total size that arr has allocated.

  • void reserve(size_t x): Same as reserve function in STL. This function will increase the capacity to x, which means to extend the size of arr to size x. Note that if x is not greater than the current capacity, the function do nothing. After reserving, all the data that had pushed in should remain the same.

  • void clear(): Same as clear function in STL. The function reset SIZE to 0. Note that CAPACITY won't change in this function. Also, this function will destruct all the elements.

After implementing these functions, we'll give you several commands:

  • push_back <t1>: call push_back(t1)

  • pop_back: call pop_back()

  • access <t1>: call v[t1]

  • size: output size()

  • capacity: output capacity()

  • reserve <t1>: call reserve(t1)

  • clear: call clear

It is guaranteed that no illegal operation will appear, such as pop_back while the vector is empty, or accessing index that exceeds the size.

Input

The first line contains an integer, indicates the number of commands.

The next lines are all commands that describe above.

The number of commands won't exceed .

The parameter of reserve will be in range of , and all other parameters will be in range of .

Output

Output when the corresponding commands appears.

 

Sample Input  Download

Sample Output  Download

Partial Judge Code

12541.cpp

Partial Judge Header

12541.h

Tags




Discuss




12543 - Endgame   

Description

episode 1: http://140.114.86.238/problem/12254/

episode 2: http://140.114.86.238/problem/12436/

episode 3: http://140.114.86.238/problem/12522/


After Iron Man grab all the infinity stones from Thanos and set them onto his hand, he now has the ability to decide the destiny of the whole universe...

After snapping, Iron Man's mind is teleported into the deepest layer of the stones. He knows who he have to eliminate, that is, the Thanos army.

Iron Man & Thanos thinking about this problem.

If you click Iron Man, something might happen...


Iron Man's mind is now located in a 2-dimension flat with lives of all creatures. He can eliminate any creature by stepping on it. Most lives are innocent creatures, and Iron Man doesn't want to eliminate them. Those lives he wants to eliminate is only the Thanos army.

As he is now in a spiritual form, he can split himself, search, and eliminate Thanos army in every direction at the same time. He can only walk up, down, left, and right. Diagonal movement such as up-left or down-right is not allowed.

Iron Man wants to know the minimum distance he have to walk in order to eliminate all the Thanos army.


You are given a flat.

Every position may be in the following state:

  • .: There's nothing here, you can pass this place without worrying.
  • I: Here is the initial position you're at. There will be exactly one I on the flat.
  • T: The Thanos army are represented as a T. You have to eliminate all T on the flat. To eliminate them, you have to step onto every place with state T at least once.
  • C: All other innocent creatures. You cannot pass by or walk on this place since Iron Man don't want to eliminate innocents.

You're going to find out the minimum furthest distance that you need to walk.

Take sample as an example, the distance is marked below, and those red places is the place where you have to go through.

323C9
C1C98
C0CC7
212C6
CC345

 

Input

The first line contains two integers and .

There are lines below. Each line contains characters, indicate the state of all positions of the flat initially.

.

Output

Output the minimum distance that Iron Man have to walk in order to eliminate all the Thanos army. If it's impossible, output -1.

Sample Input  Download

Sample Output  Download

Tags




Discuss