250642026-02-17 18:20:54sscrazyyÜtős helyzet (75 pont)cpp17Wrong answer 16/754ms508 KiB
#include <iostream>
using namespace std;

int board[9][9]; // 0=empty, 1=rook, 2=queen
int dx[] = {-1,1,0,0,-1,-1,1,1};
int dy[] = {0,0,-1,1,-1,1,-1,1};

bool attacks(int x, int y, int type) {
    int dirs = (type == 1) ? 4 : 8; // rook: 4, queen: 8
    for (int d = 0; d < dirs; d++) {
        int nx = x + dx[d], ny = y + dy[d];
        while (nx >= 1 && nx <= 8 && ny >= 1 && ny <= 8) {
            if (board[nx][ny]) return true;
            nx += dx[d]; ny += dy[d];
        }
    }
    return false;
}

int main() {
    int n;
    cin >> n;
    while (n--) {
        int t, x, y;
        cin >> t >> x >> y;
        if (t == 3) {
            board[x][y] = 0;
            cout << "-" << endl;
        } else {
            // Check if this piece attacks or is attacked
            if (!attacks(x, y, t)) {
                // Also check: does any existing piece attack (x,y)?
                // Since attacks() checks all directions from (x,y),
                // it finds any piece that could attack (x,y) too!
                board[x][y] = t;
                cout << "IGEN" << endl;
            } else {
                cout << "NEM" << endl;
            }
        }
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base16/75
1Accepted0/01ms316 KiB
2Wrong answer0/03ms316 KiB
3Accepted2/21ms508 KiB
4Accepted2/21ms316 KiB
5Wrong answer0/31ms348 KiB
6Wrong answer0/33ms380 KiB
7Wrong answer0/53ms316 KiB
8Wrong answer0/64ms316 KiB
9Wrong answer0/63ms500 KiB
10Wrong answer0/63ms316 KiB
11Wrong answer0/63ms316 KiB
12Wrong answer0/63ms316 KiB
13Wrong answer0/63ms316 KiB
14Wrong answer0/63ms332 KiB
15Wrong answer0/63ms316 KiB
16Accepted6/63ms316 KiB
17Accepted6/63ms316 KiB