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 main()
{
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int n;
cin>>n;
map<string,string> mp;
string arr[n],aee[n];;
for(int i = 0;i<n;i++){
cin>>arr[i];
mp[arr[i]] = arr[i];
}
for(int i = 0;i<n;i++){
cin>>aee[i];
mp[aee[i]] = aee[i];
}
for(int i = 0;i<n;i++){
if(!isdigit(arr[i][0])&&!isdigit(aee[i][0])){
mp[arr[i]] = mp[aee[i]];
}
}
for(int i = 0;i<n;i++){
if(isdigit(arr[i][0])&&!isdigit(aee[i][0])){
if(isdigit(mp[mp[aee[i]]][0])){
if(mp[mp[aee[i]]]!=arr[i]){
cout<<"NE\n";return 0;
}mp[mp[aee[i]]] = arr[i];
}else mp[mp[aee[i]]] = arr[i];
}if(!isdigit(arr[i][0])&&isdigit(aee[i][0])){
if(isdigit(mp[arr[i]][0])){
if(mp[mp[arr[i]]]!=aee[i]){
cout<<"NE\n";return 0;
}mp[mp[arr[i]]] = aee[i];
}else mp[mp[arr[i]]] = aee[i];
}
}
for(int i = 0;i<n;i++){
if(isdigit(arr[i][0])&&isdigit(aee[i][0])){
if(arr[i]!=aee[i]){
cout<<"NE\n";
return 0;
}
}
}
cout<<"DA\n";
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... |