This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |