#include<bits/stdc++.h>
using namespace std;
int n;
vector<string>a,b;
map<string,string>m;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin>>n;
for(int i=0;i<n;i++)
{
string s;
cin>>s;
a.push_back(s);
}
for(int i=0;i<n;i++)
{
string s;
cin>>s;
b.push_back(s);
}
bool t=true;
for(int i=0;i<n;i++)
{
string s=a[i],z=b[i];
if('0'<=s[0]&&s[0]<='9')
{
if('0'<=z[0]&&z[0]<='9')
{
if(s!=z)
{
t=false;
break;
}
}
else m[z]=s;
}
else if('0'<=z[0]&&z[0]<='9')m[s]=z;
}
for(int i=0;i<n;i++)
{
string s=a[i],z=b[i];
if(m[s].size()!=0&&m[z].size()!=0)
{
if(m[s]!=m[z])
{
t=false;
break;
}
}
if(m[s].size()==0&&m[z].size()!=0)m[s]=m[z];
if(m[s].size()!=0&&m[z].size()==0)m[z]=m[s];
}
if(t==false)cout<<"NE";
else cout<<"DA";
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
0 ms |
256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
504 KB |
Output is correct |
2 |
Correct |
3 ms |
504 KB |
Output is correct |
3 |
Correct |
4 ms |
632 KB |
Output is correct |
4 |
Incorrect |
7 ms |
888 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
16 ms |
1648 KB |
Output is correct |
2 |
Correct |
47 ms |
3184 KB |
Output is correct |
3 |
Incorrect |
64 ms |
5204 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |