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()
{
int n ;
cin >> n ;
string a[n] , a2[n];
for(int i = 0 ; i < n ; i ++)cin >> a[i];
for(int i = 0 ; i < n ; i ++)cin >> a2[i];
map<string , int > mp ;
vector<pair<string , string> > e ;
for(int i = 0 ; i < n ; i ++){
char c = a[i][0] , c2 = a2[i][0];
if(c < 97){
if(c2 < 97){
if(c != c2){
cout << "NE";
return 0 ;
}
}
else {
if(mp.count(a2[i]) && mp[a2[i]] != stoi(a[i])){
cout << "NE";
return 0;
}
else mp[a2[i]] = stoi(a[i]);
}
}
else {
if(c2 < 97){
if(mp.count(a[i]) && mp[a[i]] != stoi(a2[i])){
cout << "NE";
return 0;
}
else mp[a[i]] = stoi(a2[i]) ;
}
else {
e.push_back(make_pair(a[i] , a2[i]));
}
}
}
for(auto &it : e){
if(mp[it.first] != mp[it.second] && mp[it.first] && mp[it.second]){
cout << "NE";
return 0;
}
}
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... |