#include <bits/stdc++.h>
using namespace std;
#define int long long
void solve(){
int n; cin >>n;
map <string,vector <int>> si;
map <int,string> is;
for(int i=0; i<n; i++){
string s;
cin >>s;
if(si[s].size()==0) si[s].push_back(0);
si[s].push_back(i);
si[s][0]++;
is[i]=s;
}
vector <bool> check(n, true);
for(int i=0; i<n-1; i++){
string s;
cin >>s;
int k = si[s][si[s][0]];
si[s][0]--;
check[k]=false;
}
for(int i=0; i<n; i++){
if(check[i]) cout <<is[i];
}
}
signed main(){
int t=1;// cin >>t;
while(t--){
solve();
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
304 KB |
Output is correct |
2 |
Correct |
0 ms |
292 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
3 ms |
468 KB |
Output is correct |
5 |
Correct |
3 ms |
468 KB |
Output is correct |
6 |
Correct |
158 ms |
11980 KB |
Output is correct |
7 |
Correct |
245 ms |
17836 KB |
Output is correct |
8 |
Correct |
317 ms |
21792 KB |
Output is correct |
9 |
Correct |
346 ms |
23660 KB |
Output is correct |
10 |
Correct |
348 ms |
23716 KB |
Output is correct |