이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |