| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 12536 | People nowadays |
|
| 12541 | Vector Implementation |
|
| 12543 | Endgame |
|
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.
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
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.CAPACITYandSIZEare initially 0. -
void push_back(T x): Same aspush_backfunction in STL. Note that ifCAPACITYequals toSIZE, you have to double the size ofarrfirst, then push element in. -
T & operator [] (const int &x): Random access, same as STL. Avector<int> Vshould be able to access every element ofarrby callingV[x]. -
const T & operator [] (const int &x) const: Random access for any constant object. -
size_t size(): Same assizefunction in STL. Return the size of the vector. -
size_t capacity(): Same ascapacityfunction in STL. Return the total size thatarrhas allocated. -
void reserve(size_t x): Same asreservefunction in STL. This function will increase the capacity tox, which means to extend the size ofarrto sizex. Note that ifxis 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 asclearfunction in STL. The function resetSIZEto 0. Note thatCAPACITYwon'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>: callpush_back(t1) -
pop_back: callpop_back() -
access <t1>: callv[t1] -
size: outputsize() -
capacity: outputcapacity() -
reserve <t1>: callreserve(t1) -
clear: callclear
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.cppPartial Judge Header
12541.hTags
Discuss
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 oneIon the flat.T: The Thanos army are represented as aT. You have to eliminate allTon the flat. To eliminate them, you have to step onto every place with stateTat 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.