#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
string a[n];
unordered_map <string, int> freq2;
for(int i = 0; i < n; i++){
cin >> a[i];
freq2[a[i]] = 0;
}
for(int i = 0; i < n; i++){
freq2[a[i]]++;
}
unordered_map <string, int> freq;
string b[n - 1];
for(int i = 0; i < n - 1; i++){
cin >> b[i];
freq[b[i]] = 0;
}
for(int i = 0; i < n - 1; i++){
freq[b[i]]++;
}
for(int i = 0; i < n; i++){
if(freq2[a[i]] != freq[a[i]]){
cout << a[i];
break;
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
3 ms |
468 KB |
Output is correct |
5 |
Correct |
2 ms |
468 KB |
Output is correct |
6 |
Correct |
70 ms |
13592 KB |
Output is correct |
7 |
Correct |
150 ms |
19268 KB |
Output is correct |
8 |
Correct |
213 ms |
23240 KB |
Output is correct |
9 |
Correct |
189 ms |
26980 KB |
Output is correct |
10 |
Correct |
187 ms |
26960 KB |
Output is correct |