답안 #721326

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
721326 2023-04-10T16:56:29 Z vjudge1 Zamjena (COCI18_zamjena) C++17
14 / 70
4 ms 1492 KB
#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);
    string var = "3", vay = "3";
    for (int i = 0; i < n; i++) {
        cin >> v[i];
    }

    for (int i = 0; i < n; i++) {
        cin >> x[i];
    }

    for (int i = 0; i < n; i++) {
        if (v[i] == "x") {
            if (x[i] != "x" && x[i] != "y") {
                var = x[i];
                //break;
            }
        }
        if (v[i] == "y") {
            if (x[i] != "x" && x[i] != "y") {
                vay = x[i];
                //break;
            }
        }
    }
    for (int i = 0; i < n; i++) {
        if (x[i] == "x") {
            if (v[i] != "x" && v[i] != "y") {
                var = v[i];
                //break;
            }
        }
        if (x[i] == "y") {
            if (v[i] != "x" && v[i] != "y") {
                vay = v[i];
                //break;
            }
        }
    }


    for (int i = 0; i < n; i++) {
        if (v[i] == "x") {
            v[i] = var;
        }
        if (v[i] == "y") {
            v[i] = vay;
        }
    }
    for (int i = 0; i < n; i++) {
        if (x[i] == "x") {
            x[i] = var;
        }
        if (x[i] == "y") {
            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 3
y y y

3
3 4 5
3 4 x

7 2 1
4 7
**/
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 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 3 ms 852 KB Output is correct
2 Incorrect 4 ms 1492 KB Output isn't correct
3 Halted 0 ms 0 KB -