結果

問題 No.2702 Nand Nor Matrix
ユーザー MagentorMagentor
提出日時 2024-03-11 22:01:38
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,584 bytes
コンパイル時間 1,068 ms
コンパイル使用メモリ 89,404 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-03-11 22:02:00
合計ジャッジ時間 20,900 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,548 KB
testcase_01 AC 300 ms
6,548 KB
testcase_02 AC 291 ms
6,548 KB
testcase_03 AC 295 ms
6,548 KB
testcase_04 AC 312 ms
6,548 KB
testcase_05 AC 305 ms
6,548 KB
testcase_06 AC 295 ms
6,548 KB
testcase_07 AC 311 ms
6,548 KB
testcase_08 AC 295 ms
6,548 KB
testcase_09 AC 295 ms
6,676 KB
testcase_10 AC 296 ms
6,676 KB
testcase_11 AC 309 ms
6,676 KB
testcase_12 AC 296 ms
6,676 KB
testcase_13 AC 298 ms
6,676 KB
testcase_14 AC 322 ms
6,676 KB
testcase_15 AC 298 ms
6,676 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 RE -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 RE -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 RE -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 RE -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N;
    cin >> N;
    vector<int> A(N), B(N);
    for (int i = 0; i < N; ++i)
        cin >> A[i];
    A.push_back(A.back());
    B[0] = A[0];
    for (int i = 1; i < N; ++i)
        cin >> B[i];
    B.push_back(B.back());
    int col = 0;
    for (int i = 1; i < N; ++i) {
        if (A[i] == A[i + 1]) {
            col = i;
            break;
        }
    }
    int row = 0;
    for (int i = 1; i < N; ++i) {
        if (B[i] == B[i + 1]) {
            row = i;
            break;
        }
    }
    if (A[1] != B[1]) {
        row = 0;
        col = 0;
    }
    int change = 0;
    if (A[1] == B[1] && A[1] == 0) {
        for (int i = 0; i <= N; ++i) {
            A[i] ^= 1;
            B[i] ^= 1;
        }
        change = 1;
    }
    int Q;
    cin >> Q;
    for (int i = 0; i < Q; ++i) {
        int T, R, C;
        cin >> T >> R >> C;
        --R;
        --C;
        T -= change;
        if (R == 0) {
            cout << (A[C] ^ change) << endl;
            continue;
        }
        if (C == 0) {
            cout << (B[R] ^ change) << endl;
            continue;
        }
        if (T <= 0) {
            cout << ((T & 1) ^ change) << endl;
            continue;
        }
        if (R <= row && C <= col && R + C - 1 <= T) {
            cout << (((R + C) & 1) ^ change) << endl;
            continue;
        } else {
            cout << ((T & 1) ^ change) << endl;
            continue;
        }
    }
    return 0;
}
0