Submission #390173

#TimeUsernameProblemLanguageResultExecution timeMemory
390173ioiZamjena (COCI18_zamjena)C++14
28 / 70
12 ms2116 KiB
#include<bits/stdc++.h> using namespace std; int main() { int n ; cin >> n ; string a[n] , a2[n]; for(int i = 0 ; i < n ; i ++)cin >> a[i]; for(int i = 0 ; i < n ; i ++)cin >> a2[i]; map<string , int > mp ; vector<pair<string , string> > e ; for(int i = 0 ; i < n ; i ++){ char c = a[i][0] , c2 = a2[i][0]; if(c < 97){ if(c2 < 97){ if(c != c2){ cout << "NE"; return 0 ; } } else { if(mp.count(a2[i]) && mp[a2[i]] != stoi(a[i])){ cout << "NE"; return 0; } else mp[a2[i]] = stoi(a[i]); } } else { if(c2 < 97){ if(mp.count(a[i]) && mp[a[i]] != stoi(a2[i])){ cout << "NE"; return 0; } else mp[a[i]] = stoi(a2[i]) ; } else { e.push_back(make_pair(a[i] , a2[i])); } } } for(auto &it : e){ if(mp[it.first] != mp[it.second] && mp[it.first] && mp[it.second]){ cout << "NE"; return 0; } } cout << "DA"; }
#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...