結果

問題 No.2702 Nand Nor Matrix
ユーザー hirayuu_ychirayuu_yc
提出日時 2024-02-06 12:22:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 183 ms / 2,000 ms
コード長 951 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 102,656 KB
最終ジャッジ日時 2024-02-06 20:47:36
合計ジャッジ時間 12,204 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,460 KB
testcase_01 AC 128 ms
76,528 KB
testcase_02 AC 111 ms
76,428 KB
testcase_03 AC 110 ms
76,728 KB
testcase_04 AC 126 ms
76,924 KB
testcase_05 AC 116 ms
76,496 KB
testcase_06 AC 126 ms
76,800 KB
testcase_07 AC 131 ms
76,800 KB
testcase_08 AC 130 ms
76,792 KB
testcase_09 AC 127 ms
76,924 KB
testcase_10 AC 126 ms
76,668 KB
testcase_11 AC 128 ms
76,540 KB
testcase_12 AC 126 ms
76,668 KB
testcase_13 AC 126 ms
76,540 KB
testcase_14 AC 128 ms
76,640 KB
testcase_15 AC 107 ms
76,472 KB
testcase_16 AC 137 ms
91,284 KB
testcase_17 AC 102 ms
99,392 KB
testcase_18 AC 123 ms
87,400 KB
testcase_19 AC 144 ms
85,856 KB
testcase_20 AC 125 ms
97,004 KB
testcase_21 AC 118 ms
85,124 KB
testcase_22 AC 108 ms
84,960 KB
testcase_23 AC 138 ms
78,636 KB
testcase_24 AC 147 ms
102,556 KB
testcase_25 AC 105 ms
84,972 KB
testcase_26 AC 124 ms
89,172 KB
testcase_27 AC 148 ms
95,672 KB
testcase_28 AC 141 ms
85,992 KB
testcase_29 AC 98 ms
85,768 KB
testcase_30 AC 173 ms
102,584 KB
testcase_31 AC 141 ms
77,440 KB
testcase_32 AC 83 ms
83,252 KB
testcase_33 AC 108 ms
95,720 KB
testcase_34 AC 141 ms
87,408 KB
testcase_35 AC 161 ms
91,128 KB
testcase_36 AC 167 ms
102,656 KB
testcase_37 AC 182 ms
102,656 KB
testcase_38 AC 178 ms
102,656 KB
testcase_39 AC 163 ms
102,656 KB
testcase_40 AC 182 ms
102,656 KB
testcase_41 AC 183 ms
102,656 KB
testcase_42 AC 176 ms
102,656 KB
testcase_43 AC 179 ms
102,656 KB
testcase_44 AC 174 ms
102,656 KB
testcase_45 AC 175 ms
102,656 KB
testcase_46 AC 173 ms
102,656 KB
testcase_47 AC 179 ms
102,656 KB
testcase_48 AC 180 ms
102,656 KB
testcase_49 AC 174 ms
102,656 KB
testcase_50 AC 168 ms
102,656 KB
testcase_51 AC 102 ms
76,216 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit((1<<19)-1)
#import pypyjit
#pypyjit.set_param('max_unroll_recursion=-1')
input=sys.stdin.buffer.readline

N=int(input())
A=list(map(int,input().split()))
A.append(A[-1])
B=[A[0]]+[int(input()) for i in range(N-1)]
B.append(B[-1])
col=0
for i in range(1,N):
    if A[i]==A[i+1]:
        col=i
        break
row=0
for i in range(1,N):
    if B[i]==B[i+1]:
        row=i
        break
if A[1]!=B[1]:
    row=0
    col=0
change=0
if A[1]==B[1]==0:
    A=[i^1 for i in A]
    B=[i^1 for i in B]
    change=1
Q=int(input())
for i in range(Q):
    T,R,C=map(int,input().split())
    R-=1
    C-=1
    T-=change
    if R==0:
        print(A[C]^change)
        continue
    if C==0:
        print(B[R]^change)
        continue
    if T<=0:
        print((T&1)^change)
        continue
    if R<=row and C<=col and R+C-1<=T:
        print(((R+C)&1)^change)
        continue
    else:
        print((T&1)^change)
        continue
0