Submission #165345

#TimeUsernameProblemLanguageResultExecution timeMemory
165345AsagZamjena (COCI18_zamjena)C++14
0 / 70
33 ms6264 KiB
#include <bits/stdc++.h> using namespace std; const int N = 50000 + 123; int n; string a[N], b[N]; set <string> s; map <string, set <string>> d; int main () { cin >> n; for (int i = 1;i <= n;i ++) { cin >> a[i]; if (a[i][0] > '9') { s.insert (a[i]); } } for (int i = 1;i <= n;i ++) { cin >> b[i]; if (b[i][0] > '9') { s.insert (b[i]); } } for (int i = 1;i <= n;i ++) { if (a[i][0] > '9') { d[a[i]].insert (b[i]); } if (b[i][0] > '9') { d[b[i]].insert (a[i]); } } for (auto it : s) { int cnt = 0; for (auto v : d[it]) { if (v[0] <= '9')cnt ++; } if (cnt >= 2) { cout << "NE"; exit (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...