Please sign in first.
Submission #11585179
Source Code Expand
#include <algorithm>
#include <iostream>
#include <vector>
#include <utility>
int main(){
int N;
std::vector<std::pair<char, int>> balls;
std::cin >> N;
balls.reserve(N);
std::generate_n(std::back_inserter(balls),
N,
[]{
std::pair<char, int> tmp;
std::cin >> tmp.second >> tmp.first;
return tmp;
});
std::sort(balls.begin(), balls.end(),
[](auto const& lhs, auto const& rhs){
return lhs.first > rhs.first || (lhs.first == rhs.first && lhs.second < rhs.second);
});
for (auto const& ball : balls) {
std::cout << ball.second << std::endl;
}
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - Picking Balls |
| User | GameKazu |
| Language | C++ (GCC 9.2.1) |
| Score | 200 |
| Code Size | 755 Byte |
| Status | AC |
| Exec Time | 6 ms |
| Memory | 3632 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 200 / 200 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | s1.txt, s2.txt |
| All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, s1.txt, s2.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 01.txt | AC | 6 ms | 3576 KiB |
| 02.txt | AC | 2 ms | 3552 KiB |
| 03.txt | AC | 2 ms | 3428 KiB |
| 04.txt | AC | 2 ms | 3548 KiB |
| 05.txt | AC | 2 ms | 3556 KiB |
| 06.txt | AC | 2 ms | 3632 KiB |
| 07.txt | AC | 2 ms | 3492 KiB |
| 08.txt | AC | 2 ms | 3576 KiB |
| 09.txt | AC | 2 ms | 3604 KiB |
| 10.txt | AC | 2 ms | 3472 KiB |
| 11.txt | AC | 2 ms | 3600 KiB |
| 12.txt | AC | 2 ms | 3600 KiB |
| 13.txt | AC | 3 ms | 3424 KiB |
| 14.txt | AC | 2 ms | 3532 KiB |
| 15.txt | AC | 2 ms | 3580 KiB |
| 16.txt | AC | 2 ms | 3608 KiB |
| 17.txt | AC | 2 ms | 3556 KiB |
| 18.txt | AC | 2 ms | 3580 KiB |
| 19.txt | AC | 2 ms | 3496 KiB |
| s1.txt | AC | 2 ms | 3596 KiB |
| s2.txt | AC | 2 ms | 3488 KiB |