104992024-04-03 15:47:50MagyarKendeSZLGÜtős helyzet (75 pont)cpp17Wrong answer 21/753ms3644 KiB
#include <bits/stdc++.h>
using namespace std;

vector<vector<int>> v(8, vector<int>(8));

void setvals(int X, int Y, int type, bool diag) {
    for (int i = Y + 1; i < 8; i++) {
        v[i][X] = type;
    }
    for (int i = Y - 1; i >= 0; i--) {
        v[i][X] = type;
    }
    for (int j = X + 1; j < 8; j++) {
        v[Y][j] = type;
    }
    for (int j = X - 1; j >= 0; j--) {
        v[Y][j] = type;
    }

    if (diag) {
        for (int i = Y + 1, j = X + 1; i < 8 && j < 8; i++, j++) {
            v[i][j] = type;
        }
        for (int i = Y - 1, j = X - 1; i >= 0 && j >= 0; i--, j--) {
            v[i][j] = type;
        }
        for (int i = Y - 1, j = X + 1; i >= 0 && j < 8; i--, j++) {
            v[i][j] = type;
        }
        for (int i = Y + 1, j = X - 1; i < 8 && j >= 0; i++, j--) {
            v[i][j] = type;
        }
    }

    v[Y][X] = type;
}

bool valid(int X, int Y) {
    for (int i = Y + 1, j = X + 1; i < 8 && j < 8; i++, j++) {
        if (v[i][j]) return 0;
    }
    for (int i = Y - 1, j = X - 1; i >= 0 && j >= 0; i--, j--) {
        if (v[i][j]) return 0;
    }
    for (int i = Y - 1, j = X + 1; i >= 0 && j < 8; i--, j++) {
        if (v[i][j]) return 0;
    }
    for (int i = Y + 1, j = X - 1; i < 8 && j >= 0; i++, j--) {
        if (v[i][j]) return 0;
    }
    return 1;
}

int main() {
    cin.tie(0), ios::sync_with_stdio(0);

    int N;
    cin >> N;
    while (N--) {
        int T, X, Y;
        cin >> T >> Y >> X;
        X--; Y--;
        
        if (T == 3) {
            setvals(X, Y, 0, v[Y][X] == 2);
            cout << "-\n";
            continue;
        }

        if (v[Y][X] || (T == 2 && !valid(X, Y))) {
            cout << "NEM\n";
            continue;
        }

        setvals(X, Y, T, T == 2);
        cout << "IGEN\n";
    }
}
SubtaskSumTestVerdictTimeMemory
base21/75
1Accepted0/03ms1852 KiB
2Wrong answer0/03ms2028 KiB
3Accepted2/23ms2232 KiB
4Accepted2/23ms2396 KiB
5Accepted3/33ms2532 KiB
6Accepted3/33ms2728 KiB
7Accepted5/53ms2928 KiB
8Wrong answer0/63ms3012 KiB
9Wrong answer0/63ms3016 KiB
10Wrong answer0/63ms3012 KiB
11Wrong answer0/63ms3144 KiB
12Wrong answer0/63ms3344 KiB
13Wrong answer0/63ms3424 KiB
14Wrong answer0/63ms3424 KiB
15Wrong answer0/63ms3528 KiB
16Accepted6/63ms3520 KiB
17Wrong answer0/63ms3644 KiB