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;
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(t==false)cout<<"NE";
else cout<<"DA";
}
# | 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... |