#include <bits/stdc++.h>
using namespace std;
const int N=50000+5;
int n;
string a[N];
string b[N];
inline bool nr(string x)
{
if('0'<=x[0] && x[0]<='9')
{
return 1;
}
else
{
return 0;
}
}
inline void e(string a)
{
cout<<a<<"\n";
exit(0);
}
map<string,string>h;
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>a[i];
}
for(int i=1;i<=n;i++)
{
cin>>b[i];
}
for(int i=1;i<=n;i++)
{
if(nr(a[i]) && nr(b[i]))
{
if(a[i]!=b[i])
{
e("NE");
}
}
}
for(int i=1;i<=n;i++)
{
for(int k=1;k<=2;k++)
{
if(nr(a[i])==1 && nr(b[i])==0)
{
if(h[b[i]]=="" || h[b[i]]==a[i])
{
h[b[i]]=a[i];
}
else
{
e("NE");
}
}
swap(a[i],b[i]);
}
}
for(int i=1;i<=n;i++)
{
if(nr(a[i])==0 && nr(b[i])==0)
{
if(h[a[i]]!="" && h[b[i]]!="" && h[a[i]]!=h[b[i]])
{
e("NE");
}
}
}
e("DA");
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
3448 KB |
Output is correct |
2 |
Correct |
4 ms |
3604 KB |
Output is correct |
3 |
Correct |
4 ms |
3604 KB |
Output is correct |
4 |
Correct |
5 ms |
3604 KB |
Output is correct |
5 |
Correct |
4 ms |
3604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
3604 KB |
Output is correct |
2 |
Correct |
4 ms |
3604 KB |
Output is correct |
3 |
Correct |
4 ms |
3604 KB |
Output is correct |
4 |
Correct |
5 ms |
3716 KB |
Output is correct |
5 |
Correct |
4 ms |
3748 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
3748 KB |
Output is correct |
2 |
Correct |
4 ms |
3748 KB |
Output is correct |
3 |
Correct |
4 ms |
3748 KB |
Output is correct |
4 |
Correct |
4 ms |
3748 KB |
Output is correct |
5 |
Correct |
4 ms |
3748 KB |
Output is correct |
6 |
Incorrect |
4 ms |
3748 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
3836 KB |
Output is correct |
2 |
Correct |
5 ms |
3836 KB |
Output is correct |
3 |
Incorrect |
6 ms |
3836 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
4220 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |