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;
typedef long long ll;
bool isNum(string s){
return (s[0]>='1' && s[0]<='9');
}
int main()
{
ll n;cin>>n;
vector<string>a(n),b(n);
for(auto &i:a)cin>>i;
for(auto &i:b)cin>>i;
bool v=1;
map<string,string>mp;
map<string,bool>vis;
for(ll i=0;i<n;i++){
if(vis[a[i]]){
a[i]=mp[a[i]];
}
if(vis[b[i]]){
b[i]=mp[b[i]];
}
if(isNum(a[i]) && isNum(b[i])){
v&=(a[i]==b[i]);
}
else if(isNum(a[i])){
vis[b[i]]=1;
mp[b[i]]=a[i];
}
else if(isNum(b[i])){
vis[a[i]]=1;
mp[a[i]]=b[i];
}
}
if(v){
cout<<"DA";
}
else{
cout<<"NE";
}
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... |