#include <bits/stdc++.h>
#define pb push_back
#define whole(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using namespace std;
typedef long long ll;
typedef long double ld;
const int N = (int)5e4 + 7;
const int INF = (int)1e9 + 7;
const ll linf = (ll)1e18 + 1;
string a[N], b[N];
map<string, set<string>> st;
bool ok(string str) {
if (sz(st[str]) < 2) return true;
return false;
}
int main() {
int n; cin >> n;
for (int i = 1; i <= n; ++i) cin >> a[i];
for (int i = 1; i <= n; ++i) cin >> b[i];
set<string> all;
for (int i = 1; i <= n; ++i) {
if ('a' <= a[i][0] && a[i][0] <= 'z') {
all.insert(a[i]);
if ('a' <= b[i][0] && b[i][0] <= 'z') continue;
st[a[i]].insert(b[i]);
}
if ('a' <= b[i][0] && b[i][0] <= 'z') {
all.insert(a[i]);
if ('a' <= a[i][0] && a[i][0] <= 'z') continue;
st[b[i]].insert(a[i]);
}
}
for (auto to : all) {
if (!ok(to)) return cout << "NE\n", 0;
}
cout << "DA\n";
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
3436 KB |
Output is correct |
2 |
Incorrect |
3 ms |
3436 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
3564 KB |
Output is correct |
2 |
Incorrect |
3 ms |
3436 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
3436 KB |
Output is correct |
2 |
Correct |
3 ms |
3436 KB |
Output is correct |
3 |
Incorrect |
3 ms |
3436 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
3564 KB |
Output is correct |
2 |
Correct |
4 ms |
3564 KB |
Output is correct |
3 |
Incorrect |
6 ms |
3840 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
12 ms |
4460 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |