結果

問題 No.2702 Nand Nor Matrix
ユーザー kokoseikokosei
提出日時 2024-03-30 16:46:03
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 113 ms / 2,000 ms
コード長 868 bytes
コンパイル時間 825 ms
コンパイル使用メモリ 78,704 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-03-30 16:46:13
合計ジャッジ時間 9,436 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 57 ms
6,676 KB
testcase_02 AC 56 ms
6,676 KB
testcase_03 AC 57 ms
6,676 KB
testcase_04 AC 61 ms
6,676 KB
testcase_05 AC 59 ms
6,676 KB
testcase_06 AC 57 ms
6,676 KB
testcase_07 AC 59 ms
6,676 KB
testcase_08 AC 58 ms
6,676 KB
testcase_09 AC 57 ms
6,676 KB
testcase_10 AC 60 ms
6,676 KB
testcase_11 AC 58 ms
6,676 KB
testcase_12 AC 58 ms
6,676 KB
testcase_13 AC 58 ms
6,676 KB
testcase_14 AC 58 ms
6,676 KB
testcase_15 AC 57 ms
6,676 KB
testcase_16 AC 70 ms
6,676 KB
testcase_17 AC 35 ms
6,676 KB
testcase_18 AC 55 ms
6,676 KB
testcase_19 AC 90 ms
6,676 KB
testcase_20 AC 34 ms
6,676 KB
testcase_21 AC 43 ms
6,676 KB
testcase_22 AC 32 ms
6,676 KB
testcase_23 AC 79 ms
6,676 KB
testcase_24 AC 71 ms
6,676 KB
testcase_25 AC 36 ms
6,676 KB
testcase_26 AC 48 ms
6,676 KB
testcase_27 AC 100 ms
6,676 KB
testcase_28 AC 76 ms
6,676 KB
testcase_29 AC 15 ms
6,676 KB
testcase_30 AC 96 ms
6,676 KB
testcase_31 AC 77 ms
6,676 KB
testcase_32 AC 9 ms
6,676 KB
testcase_33 AC 27 ms
6,676 KB
testcase_34 AC 75 ms
6,676 KB
testcase_35 AC 84 ms
6,676 KB
testcase_36 AC 113 ms
6,676 KB
testcase_37 AC 109 ms
6,676 KB
testcase_38 AC 108 ms
6,676 KB
testcase_39 AC 112 ms
6,676 KB
testcase_40 AC 109 ms
6,676 KB
testcase_41 AC 109 ms
6,676 KB
testcase_42 AC 108 ms
6,676 KB
testcase_43 AC 108 ms
6,676 KB
testcase_44 AC 109 ms
6,676 KB
testcase_45 AC 110 ms
6,676 KB
testcase_46 AC 109 ms
6,676 KB
testcase_47 AC 108 ms
6,676 KB
testcase_48 AC 109 ms
6,676 KB
testcase_49 AC 111 ms
6,676 KB
testcase_50 AC 108 ms
6,676 KB
testcase_51 AC 73 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
using ll = long long;

int N, Q;
int A[202020], B[202020];
int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    cin >> N;
    for(int i = 0;i < N;i++)cin >> A[i];
    for(int i = 1;i < N;i++)cin >> B[i];
    int h = 0, w = 0;
    if(A[1] == B[1]){
        h = 1, w = 1;
        for(int c = A[1];w < N;w++,c=!c)if(A[w] != c)break;
        for(int c = A[1];h < N;h++,c=!c)if(B[h] != c)break;
    }
    cin >> Q;
    while(Q--){
        ll t; int x, y;
        cin >> t >> x >> y;
        x--, y--;
        if(x == 0){
            cout << A[y] << "\n";
        }else if(y == 0){
            cout << B[x] << "\n";
        }else if(x < h && y < w){
            cout << (t < x + y - 1 ? t % 2 : !A[1] ^ (x + y & 1)) << "\n";
        }else{
            cout << t % 2 << "\n";
        }
    }
    return 0;
}
0