結果

問題 No.2702 Nand Nor Matrix
ユーザー 鴨志田卓鴨志田卓
提出日時 2024-04-02 12:17:06
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 795 bytes
コンパイル時間 2,278 ms
コンパイル使用メモリ 201,280 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-30 23:10:16
合計ジャッジ時間 9,351 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 8 WA * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

const int N = 2e5 + 10;

int n, w, h, a[N], b[N];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    for(int i = 1; i <= n; i ++) {
        cin >> a[i];
    }

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

    if(a[2] == b[2]) {
        for(w = 2; w < n && a[w] != a[w + 1]; w ++);
        for(h = 2; h < n && b[h] != b[h + 1]; h ++);
    }

    int q;
    cin >> q;
    for(int i = 1; i <= q; i ++) {
        long long t;
        int x, y;
        cin >> t >> x >> y;
        if(x == 1) cout << a[y] << "\n";
        else if(y == 1) cout << b[x] << "\n";
        else if(x <= h && y <= w && t >= max(x, y) - 1) cout << ((a[2] ^ (x + y - 3)) & 1) << "\n";
        else cout << (t & 1) << "\n";
    }
}
0