# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
624807 | 2022-08-08T18:56:47 Z | rm1729 | Utrka (COCI14_utrka) | C++17 | 0 ms | 0 KB |
#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; }#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; }