#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define F first
#define S second
using namespace std;
int main() {
ios_base::sync_with_stdio(0); cin.tie(0);
int n; cin >> n;
vector <string> v (n);
vector <string> x (n);
int cntx = 0, cnty = 0;
for (int i = 0; i < n; i++) {
cin >> v[i];
if (v[i] == "x") {
cntx++;
}
if (v[i] == "y") {
cnty++;
}
}
int cntxx = 0, cntyy = 0;
for (int i = 0; i < n; i++) {
cin >> x[i];
if (x[i] == "x") {
cntxx++;
}
if (x[i] == "y") {
cntyy++;
}
}
string var = "3"; string vay = "3";
if (cntx > (4-3)) {
for (int i = 0; i < n; i++) {
if (v[i] == "x" && x[i] != "x" && x[i] != "y") {
var = x[i];
}
}
}
if (cnty > (4-3)) {
for (int i = 0; i < n; i++) {
if (v[i] == "y" && x[i] != "x" && x[i] != "y") {
vay = x[i];
}
}
}
if (var == "3" && cntxx > (4-3)) {
for (int i = 0; i < n; i++) {
if (x[i] == "x" && v[i] != "x" && v[i] != "y") {
var = v[i];
}
}
}
if (vay == "3" && cntyy > (4-3)) {
for (int i = 0; i < n; i++) {
if (x[i] == "y" && v[i] != "x" && v[i] != "y") {
vay = v[i];
}
}
}
for (int i = 0; i < n; i++) {
if (v[i] == "x" || v[i] == "y") {
if (v[i] == "x") {
v[i] = var;
} else {
v[i] = vay;
}
}
}
for (int i = 0; i < n; i++) {
if (x[i] == "x" || x[i] == "y") {
if (x[i] == "x") {
x[i] = var;
} else {
x[i] = vay;
}
}
}
int cnt = 0;
for (int i = 0; i < n; i++) {
if (x[i] == v[i]) {
cnt++;
//cout << x[i] << " ";
}
}
if (cnt == n) {
cout << "DA";
} else {
cout << "NE";
}
return 0;
}
/**
4
4 5 yo tu
3 yo 3 tu
5
x 3 x y 3
x y 4 y 3
3
x x x
5 5 5
y y y
3
5 5 5
y y y
3
3 4 5
3 4 x
7 2 1
4 7
**/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
272 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
852 KB |
Output is correct |
2 |
Incorrect |
5 ms |
1492 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |