結果
問題 | No.2702 Nand Nor Matrix |
ユーザー | sotanishy |
提出日時 | 2024-03-29 22:56:54 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,733 bytes |
コンパイル時間 | 353 ms |
コンパイル使用メモリ | 81,920 KB |
実行使用メモリ | 132,352 KB |
最終ジャッジ日時 | 2024-09-30 16:43:26 |
合計ジャッジ時間 | 16,364 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 37 ms
52,480 KB |
testcase_01 | AC | 207 ms
121,460 KB |
testcase_02 | AC | 203 ms
121,492 KB |
testcase_03 | AC | 196 ms
121,488 KB |
testcase_04 | AC | 212 ms
121,248 KB |
testcase_05 | AC | 203 ms
121,280 KB |
testcase_06 | AC | 209 ms
121,396 KB |
testcase_07 | AC | 205 ms
121,616 KB |
testcase_08 | AC | 207 ms
121,468 KB |
testcase_09 | AC | 209 ms
121,628 KB |
testcase_10 | AC | 208 ms
121,356 KB |
testcase_11 | AC | 209 ms
121,804 KB |
testcase_12 | AC | 209 ms
121,728 KB |
testcase_13 | AC | 209 ms
121,764 KB |
testcase_14 | AC | 206 ms
121,724 KB |
testcase_15 | AC | 201 ms
121,468 KB |
testcase_16 | AC | 225 ms
112,244 KB |
testcase_17 | AC | 135 ms
99,684 KB |
testcase_18 | AC | 184 ms
103,736 KB |
testcase_19 | AC | 263 ms
124,708 KB |
testcase_20 | AC | 143 ms
96,640 KB |
testcase_21 | AC | 159 ms
96,412 KB |
testcase_22 | AC | 137 ms
90,968 KB |
testcase_23 | AC | 241 ms
119,056 KB |
testcase_24 | AC | 231 ms
109,256 KB |
testcase_25 | AC | 146 ms
94,336 KB |
testcase_26 | AC | 170 ms
99,736 KB |
testcase_27 | AC | 267 ms
128,224 KB |
testcase_28 | AC | 231 ms
115,772 KB |
testcase_29 | AC | 100 ms
84,608 KB |
testcase_30 | AC | 286 ms
124,904 KB |
testcase_31 | AC | 228 ms
121,424 KB |
testcase_32 | AC | 81 ms
81,992 KB |
testcase_33 | AC | 123 ms
94,180 KB |
testcase_34 | AC | 226 ms
115,304 KB |
testcase_35 | AC | 255 ms
120,176 KB |
testcase_36 | AC | 292 ms
131,724 KB |
testcase_37 | AC | 312 ms
130,688 KB |
testcase_38 | AC | 318 ms
130,948 KB |
testcase_39 | AC | 300 ms
131,580 KB |
testcase_40 | AC | 315 ms
130,568 KB |
testcase_41 | AC | 316 ms
130,692 KB |
testcase_42 | AC | 306 ms
130,832 KB |
testcase_43 | AC | 311 ms
130,688 KB |
testcase_44 | AC | 317 ms
132,048 KB |
testcase_45 | AC | 323 ms
132,352 KB |
testcase_46 | AC | 320 ms
132,236 KB |
testcase_47 | AC | 315 ms
130,696 KB |
testcase_48 | AC | 321 ms
130,764 KB |
testcase_49 | AC | 319 ms
131,112 KB |
testcase_50 | AC | 310 ms
130,632 KB |
testcase_51 | RE | - |
ソースコード
import sys input = sys.stdin.readline T = 20 def naive(N, A, B, qs): X = [[[0] * N for _ in range(N)] for _ in range(T)] for i in range(N): X[0][0][i] = A[i] for i in range(1, N): X[0][i][0] = B[i] # print(*["".join(map(str, row)) for row in X], sep="\n") # print() for t in range(1, T): for i in range(N): for j in range(N): if i == 0 or j == 0: X[t][i][j] = X[t - 1][i][j] else: X[t][i][j] = ( 0 if X[t - 1][i][j] + X[t - 1][i - 1][j] + X[t - 1][i][j - 1] >= 2 else 1 ) # print(*["".join(map(str, row)) for row in X], sep="\n") # print() return [X[t][r][c] for t, r, c in qs] def solve(N, A, B, qs): row = [-1] * N row[0] = B[1] for i in range(1, N): if row[i - 1] == A[i]: row[i] = A[i] ^ 1 else: break col = [-1] * N col[0] = A[1] for i in range(1, N): if col[i - 1] == B[i]: col[i] = B[i] ^ 1 else: break ans = [] for t, r, c in qs: x = -1 if r == 0: x = A[c] elif c == 0: x = B[r] elif col[r] == -1 or row[c] == -1 or r + c > t + 1: x = t % 2 else: x = A[c] ^ B[r] ^ A[1] ^ 1 ans.append(x) return ans N = int(input()) A = list(map(int, input().split())) B = [A[0]] + [int(input()) for _ in range(N - 1)] Q = int(input()) qs = [] for _ in range(Q): t, r, c = map(int, input().split()) qs.append((t, r - 1, c - 1)) print(*solve(N, A, B, qs), sep="\n")