結果
問題 | No.1296 OR or NOR |
ユーザー | googol_S0 |
提出日時 | 2020-11-20 22:07:06 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 546 bytes |
コンパイル時間 | 292 ms |
コンパイル使用メモリ | 85,932 KB |
実行使用メモリ | 133,924 KB |
最終ジャッジ日時 | 2023-09-30 19:19:55 |
合計ジャッジ時間 | 27,245 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 75 ms
71,020 KB |
testcase_01 | AC | 74 ms
70,828 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | AC | 532 ms
131,832 KB |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | AC | 578 ms
132,148 KB |
testcase_18 | AC | 584 ms
133,924 KB |
testcase_19 | AC | 603 ms
132,112 KB |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | AC | 440 ms
114,304 KB |
testcase_23 | AC | 453 ms
114,412 KB |
testcase_24 | AC | 462 ms
114,156 KB |
testcase_25 | AC | 467 ms
113,796 KB |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | AC | 482 ms
113,420 KB |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | AC | 766 ms
115,156 KB |
testcase_34 | AC | 745 ms
115,272 KB |
ソースコード
N=int(input()) A=list(map(int,input().split())) Q=int(input()) B=list(map(int,input().split())) X=[-1]*60 for i in range(60): for j in range(N-1,-1,-1): if A[j]&(1<<i): X[i]=j break for i in range(Q): Y,Z=set(),set() for j in range(60): if B[i]&(1<<j): Y.add(X[j]) else: Z.add(X[j]) if len(Y&Z): print(-1) else: V=list(Y|Z) P=0 for j in range(len(V)): if V[j] in Y: if (P&1)^(V[j]==-1): P+=1 else: if (P&1)^(V[j]!=-1): P+=1 print(P)