| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 11490 | The Cat Society |
|
| 12316 | Min-Heap |
|
| 12822 | cppreference for set and map |
|
Description
Wild cats take care of each other in the wild. However, when winter comes, the preys are not enough to feed all the cats. Therefore, the cats dine according to the order of their occupations. The order is as follows:
1. elder
2. nursy
3. kitty
4. warrior
5. apprentice
6. medicent
7. deputy
8. leader
In the tradition of the cat society, three different cats serve as the medicent, the deputy, and the leader respectively.
As for the other cats, except that the apprentices have the dining priority of the young over the old, for the other occupations, the old have higher priority. If the occupations and the ages of two or more cats are the same, they will dine in lexicographic order according to their names.
Input
There are multiple test cases.
The first line of each test case contains two integers N and M, indicating the number of cats and the portions of food respectively, where 0<N,M<=10000.
The next N lines are the information of each cat, including name, occupation, and age.
The length of the names will not exceed 30 letters and will contain no spaces.
Output
Please output the cats that could eat the food in order, each name a line.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Please maintain a min-heap, which stores integers and is able to support following operations:
(1) PUSH k – Insert an integer k into the heap. k will fit in a 32-bit signed integer.
(2) POP – Delete the minimum element from the heap. Do nothing if no elements in heap.
(3) TOP – Print the minimum element in the heap.
Input
There is only one set of commands. Each command occupies a line, and the total number of commands is less than or equal to 500000. You may assume that the number of elements stored in the heap will be no more than 15000 at any time.
Output
For each “TOP” command, output a line containing the value of the element on the top of the heap. In case that the heap is empty, print ”Null” instead.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Member functions for std::set
|
(constructor)
|
constructs the set(public member function) |
|
(destructor)
|
destructs the set(public member function) |
|
operator=
|
assigns values to the container (public member function) |
|
get_allocator
|
returns the associated allocator (public member function) |
Iterators |
|
|
begincbegin
(C++11)
|
returns an iterator to the beginning (public member function) |
|
endcend
(C++11)
|
returns an iterator to the end (public member function) |
|
rbegincrbegin
(C++11)
|
returns a reverse iterator to the beginning (public member function) |
|
rendcrend
(C++11)
|
returns a reverse iterator to the end (public member function) |
Capacity |
|
|
empty
|
checks whether the container is empty (public member function) |
|
size
|
returns the number of elements (public member function) |
|
max_size
|
returns the maximum possible number of elements (public member function) |
Modifiers |
|
|
clear
|
clears the contents (public member function) |
|
insert
|
inserts elements or nodes (since C++17) (public member function) |
|
emplace
(C++11)
|
constructs element in-place (public member function) |
|
emplace_hint
(C++11)
|
constructs elements in-place using a hint (public member function) |
|
erase
|
erases elements (public member function) |
|
swap
|
swaps the contents (public member function) |
|
extract
(C++17)
|
extracts nodes from the container (public member function) |
|
merge
(C++17)
|
splices nodes from another container (public member function) |
Lookup |
|
|
count
|
returns the number of elements matching specific key (public member function) |
|
find
|
finds element with specific key (public member function) |
|
contains
(C++20)
|
checks if the container contains element with specific key (public member function) |
|
equal_range
|
returns range of elements matching a specific key (public member function) |
|
lower_bound
|
returns an iterator to the first element not less than the given key (public member function) |
|
upper_bound
|
returns an iterator to the first element greater than the given key (public member function) |
Observers |
|
|
key_comp
|
returns the function that compares keys (public member function) |
|
value_comp
|
returns the function that compares keys in objects of type value_type (public member function) |
Member functions for std::map
|
(constructor)
|
constructs the map(public member function) |
|
(destructor)
|
destructs the map(public member function) |
|
operator=
|
assigns values to the container (public member function) |
|
get_allocator
|
returns the associated allocator (public member function) |
Element access |
|
|
at
(C++11)
|
access specified element with bounds checking (public member function) |
|
operator[]
|
access or insert specified element (public member function) |
Iterators |
|
|
begincbegin
(C++11)
|
returns an iterator to the beginning (public member function) |
|
endcend
(C++11)
|
returns an iterator to the end (public member function) |
|
rbegincrbegin
(C++11)
|
returns a reverse iterator to the beginning (public member function) |
|
rendcrend
(C++11)
|
returns a reverse iterator to the end (public member function) |
Capacity |
|
|
empty
|
checks whether the container is empty (public member function) |
|
size
|
returns the number of elements (public member function) |
|
max_size
|
returns the maximum possible number of elements (public member function) |
Modifiers |
|
|
clear
|
clears the contents (public member function) |
|
insert
|
inserts elements or nodes (since C++17) (public member function) |
|
insert_or_assign
(C++17)
|
inserts an element or assigns to the current element if the key already exists (public member function) |
|
emplace
(C++11)
|
constructs element in-place (public member function) |
|
emplace_hint
(C++11)
|
constructs elements in-place using a hint (public member function) |
|
try_emplace
(C++17)
|
inserts in-place if the key does not exist, does nothing if the key exists (public member function) |
|
erase
|
erases elements (public member function) |
|
swap
|
swaps the contents (public member function) |
|
extract
(C++17)
|
extracts nodes from the container (public member function) |
|
merge
(C++17)
|
splices nodes from another container (public member function) |
Lookup |
|
|
count
|
returns the number of elements matching specific key (public member function) |
|
find
|
finds element with specific key (public member function) |
|
contains
(C++20)
|
checks if the container contains element with specific key (public member function) |
|
equal_range
|
returns range of elements matching a specific key (public member function) |
|
lower_bound
|
returns an iterator to the first element not less than the given key (public member function) |
|
upper_bound
|
returns an iterator to the first element greater than the given key (public member function) |
Observers |
|
|
key_comp
|
returns the function that compares keys (public member function) |
|
value_comp
|
returns the function that compares keys in objects of type value_type (public member function) |