#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ar array
int n;
string a[50000], b[50000];
map<string, int> mp;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n;
for (int i = 0; i < n; ++i)
cin >> a[i];
for (int i = 0; i < n; ++i)
cin >> b[i];
for (int i = 0; i < n; ++i) {
if (a[i] == b[i])
continue;
if (isdigit(a[i][0]) && isdigit(b[i][0])) {
cout << "NE";
return 0;
}
else if (isdigit(a[i][0]) && isalpha(b[i][0])) {
int x = stoi(a[i]);
auto it = mp.find(b[i]);
if (it == mp.end())
mp[b[i]] = x;
else if (it->second ^ x) {
cout << "NE";
return 0;
}
}
else if (isalpha(a[i][0]) && isdigit(b[i][0])) {
int x = stoi(b[i]);
auto it = mp.find(a[i]);
if (it == mp.end())
mp[a[i]] = x;
else if (it->second ^ x) {
cout << "NE";
return 0;
}
}
}
for (int i = 0; i < n; ++i)
if (isalpha(a[i][0]) && isalpha(b[i][0]) && a[i] != b[i] && mp[a[i]] != mp[b[i]]) {
cout << "NE";
return 0;
}
cout << "DA";
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
3456 KB |
Output is correct |
2 |
Correct |
3 ms |
3448 KB |
Output is correct |
3 |
Correct |
3 ms |
3436 KB |
Output is correct |
4 |
Correct |
3 ms |
3436 KB |
Output is correct |
5 |
Correct |
3 ms |
3436 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
3456 KB |
Output is correct |
2 |
Correct |
3 ms |
3436 KB |
Output is correct |
3 |
Correct |
3 ms |
3436 KB |
Output is correct |
4 |
Correct |
3 ms |
3436 KB |
Output is correct |
5 |
Correct |
3 ms |
3436 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
3436 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
3436 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
3564 KB |
Output is correct |
2 |
Incorrect |
8 ms |
3820 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |