#include <bits/stdc++.h>
using namespace std;
string s[100009],s2[100009];
int n,val[100009];
map<string,int>m;
int main()
{
cin>>n;
m["0"]=0;
m["1"]=1;
m["2"]=2;
m["3"]=3;
m["4"]=4;
m["5"]=5;
m["6"]=6;
m["7"]=7;
m["8"]=8;
m["9"]=9;
memset(val,-1,sizeof(val));
for(int i=0;i<n;i++)
{
cin>>s[i];
if(s[i].size()==1&&(s[i][0]-'0'<=9))val[i]=s[i][0]-'0';
else m[s[i]]=-1;
}
for(int i=0;i<n;i++)
{
cin>>s2[i];
if(s2[i].size()==1&&(s2[i][0]-'0'<=9))val[i]=s2[i][0]-'0';
else m[s2[i]]=-1;
}
for(int i=0;i<n;i++)
{
if(m[s[i]]==-1&&m[s2[i]]==-1)continue;
else if(m[s[i]]!=-1&&m[s2[i]]!=-1&&m[s[i]]!=m[s2[i]]){cout<<"NE";/*1 "<<i<<" "<<m[s[i]]<<" "<<m[s2[i]]*/;return 0;}
m[s[i]]=max(m[s[i]],m[s2[i]]);
m[s2[i]]=max(m[s[i]],m[s2[i]]);
}
for(int i=0;i<n;i++)
{
if(m[s[i]]==-1&&m[s2[i]]==-1)continue;
else if(m[s[i]]!=-1&&m[s2[i]]!=-1&&m[s[i]]!=m[s2[i]]){cout<<"NE";return 0;}
m[s[i]]=max(m[s[i]],m[s2[i]]);
m[s2[i]]=max(m[s[i]],m[s2[i]]);
}
cout<<"DA";
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
6904 KB |
Output is correct |
2 |
Correct |
8 ms |
6904 KB |
Output is correct |
3 |
Correct |
8 ms |
6904 KB |
Output is correct |
4 |
Correct |
8 ms |
6904 KB |
Output is correct |
5 |
Correct |
8 ms |
7032 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
6904 KB |
Output is correct |
2 |
Correct |
8 ms |
6904 KB |
Output is correct |
3 |
Correct |
8 ms |
6904 KB |
Output is correct |
4 |
Correct |
9 ms |
7032 KB |
Output is correct |
5 |
Correct |
9 ms |
6904 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
6904 KB |
Output is correct |
2 |
Correct |
8 ms |
6904 KB |
Output is correct |
3 |
Incorrect |
9 ms |
6904 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
7032 KB |
Output is correct |
2 |
Correct |
9 ms |
7032 KB |
Output is correct |
3 |
Incorrect |
14 ms |
7152 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
32 ms |
7548 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |