#include<bits/stdc++.h>
using namespace std;
int main()
{
int n ;
cin >> n ;
string a[n] , a2[n];
for(int i = 0 ; i < n ; i ++)cin >> a[i];
for(int i = 0 ; i < n ; i ++)cin >> a2[i];
map<string , int > mp ;
vector<pair<string , string> > e ;
for(int i = 0 ; i < n ; i ++){
char c = a[i][0] , c2 = a2[i][0];
if(c < 97){
if(c2 < 97){
if(c != c2){
cout << "NE";
return 0 ;
}
}
else {
if(mp.count(a2[i]) && mp[a2[i]] != stoi(a[i])){
cout << "NE";
return 0;
}
else mp[a2[i]] = stoi(a[i]);
}
}
else {
if(c2 < 97){
if(mp.count(a[i]) && mp[a[i]] != stoi(a2[i])){
cout << "NE";
return 0;
}
else mp[a[i]] = stoi(a2[i]) ;
}
else {
e.push_back(make_pair(a[i] , a2[i]));
}
}
}
for(auto &it : e){
if(mp[it.first] != mp[it.second] && mp[it.first] && mp[it.second]){
cout << "NE";
return 0;
}
}
cout << "DA";
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
300 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
300 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
296 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
436 KB |
Output is correct |
2 |
Correct |
1 ms |
460 KB |
Output is correct |
3 |
Incorrect |
6 ms |
844 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
12 ms |
2116 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |