#include <iostream>
#include <string>
#include <unordered_set>
#include <cassert>
int main() {
using namespace std;
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N;
cin >> N;
N = N * 2 - 1;
unordered_set<string> s;
string x;
for (int i = N; i--; ) {
cin >> x;
auto it = s.find(x);
if (it == s.end()) s.insert(x);
else s.erase(it);
}
assert(s.size() == 1);
cout << (*s.begin()) << '\n';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
496 KB |
Output is correct |
3 |
Correct |
3 ms |
496 KB |
Output is correct |
4 |
Correct |
3 ms |
608 KB |
Output is correct |
5 |
Correct |
4 ms |
712 KB |
Output is correct |
6 |
Correct |
65 ms |
5532 KB |
Output is correct |
7 |
Correct |
133 ms |
9180 KB |
Output is correct |
8 |
Correct |
150 ms |
12376 KB |
Output is correct |
9 |
Correct |
152 ms |
15152 KB |
Output is correct |
10 |
Correct |
185 ms |
17432 KB |
Output is correct |