Submission #167253

#TimeUsernameProblemLanguageResultExecution timeMemory
167253mdn2002Zamjena (COCI18_zamjena)C++14
28 / 70
64 ms5204 KiB
#include<bits/stdc++.h> using namespace std; int n; vector<string>a,b; map<string,string>m; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin>>n; for(int i=0;i<n;i++) { string s; cin>>s; a.push_back(s); } for(int i=0;i<n;i++) { string s; cin>>s; b.push_back(s); } bool t=true; for(int i=0;i<n;i++) { string s=a[i],z=b[i]; if('0'<=s[0]&&s[0]<='9') { if('0'<=z[0]&&z[0]<='9') { if(s!=z) { t=false; break; } } else m[z]=s; } else if('0'<=z[0]&&z[0]<='9')m[s]=z; } for(int i=0;i<n;i++) { string s=a[i],z=b[i]; if(m[s].size()!=0&&m[z].size()!=0) { if(m[s]!=m[z]) { t=false; break; } } if(m[s].size()==0&&m[z].size()!=0)m[s]=m[z]; if(m[s].size()!=0&&m[z].size()==0)m[z]=m[s]; } if(t==false)cout<<"NE"; else 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...