This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |