Submission #472262

#TimeUsernameProblemLanguageResultExecution timeMemory
472262Ahmed57Zamjena (COCI18_zamjena)C++14
28 / 70
12 ms1580 KiB
#include<bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); int n; cin>>n; map<string,string> mp; string arr[n],aee[n];; for(int i = 0;i<n;i++){ cin>>arr[i]; mp[arr[i]] = arr[i]; } for(int i = 0;i<n;i++){ cin>>aee[i]; mp[aee[i]] = aee[i]; } for(int i = 0;i<n;i++){ if(!isdigit(arr[i][0])&&!isdigit(aee[i][0])){ mp[arr[i]] = mp[aee[i]]; } } for(int i = 0;i<n;i++){ if(isdigit(arr[i][0])&&!isdigit(aee[i][0])){ if(isdigit(mp[mp[aee[i]]][0])){ if(mp[mp[aee[i]]]!=arr[i]){ cout<<"NE\n";return 0; }mp[mp[aee[i]]] = arr[i]; }else mp[mp[aee[i]]] = arr[i]; }if(!isdigit(arr[i][0])&&isdigit(aee[i][0])){ if(isdigit(mp[arr[i]][0])){ if(mp[mp[arr[i]]]!=aee[i]){ cout<<"NE\n";return 0; }mp[mp[arr[i]]] = aee[i]; }else mp[mp[arr[i]]] = aee[i]; } } for(int i = 0;i<n;i++){ if(isdigit(arr[i][0])&&isdigit(aee[i][0])){ if(arr[i]!=aee[i]){ cout<<"NE\n"; return 0; } } } cout<<"DA\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...