Submission #85328

#TimeUsernameProblemLanguageResultExecution timeMemory
85328314rateZamjena (COCI18_zamjena)C++14
28 / 70
10 ms4220 KiB
#include <bits/stdc++.h> using namespace std; const int N=50000+5; int n; string a[N]; string b[N]; inline bool nr(string x) { if('0'<=x[0] && x[0]<='9') { return 1; } else { return 0; } } inline void e(string a) { cout<<a<<"\n"; exit(0); } map<string,string>h; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin>>n; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { cin>>b[i]; } for(int i=1;i<=n;i++) { if(nr(a[i]) && nr(b[i])) { if(a[i]!=b[i]) { e("NE"); } } } for(int i=1;i<=n;i++) { for(int k=1;k<=2;k++) { if(nr(a[i])==1 && nr(b[i])==0) { if(h[b[i]]=="" || h[b[i]]==a[i]) { h[b[i]]=a[i]; } else { e("NE"); } } swap(a[i],b[i]); } } for(int i=1;i<=n;i++) { if(nr(a[i])==0 && nr(b[i])==0) { if(h[a[i]]!="" && h[b[i]]!="" && h[a[i]]!=h[b[i]]) { e("NE"); } } } e("DA"); 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...