#include <bits/stdc++.h>
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define up_b upper_bound
#define low_b lower_bound
#define sz(x) (int)x.size()
#define all(v) v.begin(),v.end()
#define boost ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
typedef pair<ll,ll> pll;
const ll INF=1e18;
const int inf = 2e9;
const ld eps=1e-7;
const ld pi = acos(-1);
const int dx[4]={0,0 ,1,-1};
const int dy[4]={1,-1,0,0};
const int N=5e4+11;
const int M=21;
const int mod=1e9+7;
map<string,string>d;
string a[N],b[N];
int main(){
int n;
cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i];
}
for(int i=1;i<=n;i++){
cin>>b[i];
if(isalpha(a[i][0])){
if(!isalpha(b[i][0])){
d[b[i]]=b[i];
if(d[a[i]]==""){
d[a[i]]=b[i];
}
else if(d[a[i]]!=b[i]){
cout<<"NE";
return 0;
}
}
}
else{
d[a[i]]=a[i];
if(isalpha(b[i][0])){
if(d[b[i]]==""){
d[b[i]]=a[i];
}
else if(d[b[i]]!=a[i]){
cout<<"NE";
return 0;
}
}
else{
d[b[i]]=b[i];
if(a[i]!=b[i]){
cout<<"NE";
return 0;
}
}
}
}
for(int i=1;i<=n;i++){
if(d[a[i]]!=d[b[i]]&&d[a[i]]!=""&&d[b[i]]!=""){
cout<<"NE";
return 0;
}
}
cout<<"DA";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
3448 KB |
Output is correct |
2 |
Correct |
4 ms |
3448 KB |
Output is correct |
3 |
Correct |
4 ms |
3448 KB |
Output is correct |
4 |
Correct |
4 ms |
3448 KB |
Output is correct |
5 |
Correct |
5 ms |
3448 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
3448 KB |
Output is correct |
2 |
Correct |
4 ms |
3448 KB |
Output is correct |
3 |
Correct |
4 ms |
3448 KB |
Output is correct |
4 |
Correct |
5 ms |
3448 KB |
Output is correct |
5 |
Correct |
4 ms |
3448 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
3448 KB |
Output is correct |
2 |
Correct |
4 ms |
3448 KB |
Output is correct |
3 |
Correct |
4 ms |
3448 KB |
Output is correct |
4 |
Correct |
4 ms |
3448 KB |
Output is correct |
5 |
Correct |
5 ms |
3448 KB |
Output is correct |
6 |
Incorrect |
4 ms |
3448 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
3448 KB |
Output is correct |
2 |
Correct |
6 ms |
3448 KB |
Output is correct |
3 |
Incorrect |
9 ms |
3704 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
18 ms |
4088 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |