#include <bits/stdc++.h>
#define endl "\n"
#define F first
#define S second
#define pb push_back
#define all(x) x.begin() , x.end()
#define mm1(dp) memset (dp , -1 , sizeof dp)
#define mm0(dp) memset (dp , 0 , sizeof dp)
#define mmo(dp) memset (dp , oo , sizeof dp)
#define mid ((r+l)>>1)
#define lx (n<<1)
#define rx ((n<<1)|1)
typedef long long ll;
using namespace std;
const int N = 1e6+5;
const int MOD = 1e9+7;
const long long oo = 4557430888798830399 ;
string a[N] , b[N] ;
bool is[N] , is2[N] ;
map <string , string> mp ;
ll n ;
int main()
{
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin >> n ;
for (int i = 0 ; i<n ; i++)
{
cin >> a[i] ;
if (a[i][0] >= '0' && a[i][0] <= '9')
is[i] = true ;
}
for (int i = 0 ; i<n ; i++)
{
cin >> b[i] ;
if (b[i][0] >= '0' && b[i][0] <= '9')
is2[i] = true ;
}
for (int i = 0 ; i<n ; i++)
{
if (is[i] && is2[i])
{
if (a[i] != b[i])
{
cout << "NE" ;
return 0 ;
}
else
continue ;
}
else
{
if (is[i])
{
mp[b[i]] = a[i] ;
}
if (is2[i])
{
mp[a[i]] = b[i] ;
}
}
}
for (int i = 0 ; i<n ; i++)
{
if (is[i] && !is2[i])
{
if (a[i] != mp[b[i]])
{
cout << "NE" ;
return 0 ;
}
}
if (is2[i] && !is[i])
{
if (mp[a[i]] != b[i])
{
cout << "NE" ;
return 0 ;
}
}
if (!is[i] && !is2[i])
{
if (mp[a[i]] != mp[b[i]] && mp[a[i]] != "" && mp[b[i]] != "")
{
cout << "NE" ;
return 0 ;
}
}
}
cout << "DA" ;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
29 ms |
63060 KB |
Output is correct |
2 |
Correct |
30 ms |
62956 KB |
Output is correct |
3 |
Correct |
29 ms |
62960 KB |
Output is correct |
4 |
Correct |
29 ms |
62936 KB |
Output is correct |
5 |
Correct |
29 ms |
62932 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
29 ms |
62932 KB |
Output is correct |
2 |
Correct |
32 ms |
62964 KB |
Output is correct |
3 |
Correct |
30 ms |
62932 KB |
Output is correct |
4 |
Correct |
30 ms |
62852 KB |
Output is correct |
5 |
Correct |
30 ms |
62908 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
29 ms |
62924 KB |
Output is correct |
2 |
Correct |
32 ms |
63072 KB |
Output is correct |
3 |
Correct |
30 ms |
62856 KB |
Output is correct |
4 |
Correct |
29 ms |
62840 KB |
Output is correct |
5 |
Correct |
31 ms |
62932 KB |
Output is correct |
6 |
Incorrect |
29 ms |
62932 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
30 ms |
62932 KB |
Output is correct |
2 |
Correct |
32 ms |
62988 KB |
Output is correct |
3 |
Incorrect |
31 ms |
63132 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
35 ms |
63572 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |