結果

問題 No.1896 Arrays and XOR Procedure 2
ユーザー ああいいああいい
提出日時 2022-04-08 22:31:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 83 ms / 2,000 ms
コード長 627 bytes
コンパイル時間 301 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 77,416 KB
最終ジャッジ日時 2024-05-06 08:02:57
合計ジャッジ時間 5,839 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
51,840 KB
testcase_01 AC 37 ms
51,712 KB
testcase_02 AC 37 ms
52,284 KB
testcase_03 AC 62 ms
72,320 KB
testcase_04 AC 80 ms
77,184 KB
testcase_05 AC 80 ms
77,056 KB
testcase_06 AC 66 ms
73,472 KB
testcase_07 AC 81 ms
77,056 KB
testcase_08 AC 80 ms
77,416 KB
testcase_09 AC 81 ms
77,312 KB
testcase_10 AC 82 ms
77,284 KB
testcase_11 AC 80 ms
77,056 KB
testcase_12 AC 82 ms
77,228 KB
testcase_13 AC 77 ms
76,928 KB
testcase_14 AC 77 ms
77,056 KB
testcase_15 AC 76 ms
77,016 KB
testcase_16 AC 75 ms
76,672 KB
testcase_17 AC 74 ms
76,544 KB
testcase_18 AC 64 ms
70,784 KB
testcase_19 AC 52 ms
64,512 KB
testcase_20 AC 80 ms
77,284 KB
testcase_21 AC 52 ms
64,384 KB
testcase_22 AC 81 ms
77,184 KB
testcase_23 AC 81 ms
76,900 KB
testcase_24 AC 83 ms
76,984 KB
testcase_25 AC 80 ms
76,928 KB
testcase_26 AC 81 ms
77,004 KB
testcase_27 AC 83 ms
76,800 KB
testcase_28 AC 64 ms
72,704 KB
testcase_29 AC 64 ms
72,832 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

S = 0
for a in A:
    S |= a
import sys
if S == 0:
    print(0)
    exit()
mask = 1 << (len(bin(S)) - 3)
index = -1
for i in range(N):
    if A[i] & mask:
        index = i
        break

ans = []
for j in range(N):
    if mask & B[j] == 0:
        ans.append((2,index + 1,j + 1))
        B[j] ^= A[index]
index = -1
_min = 1 << 40
for i in range(N):
    if B[i] < _min:
        _min = B[i]
        index = i
for j in range(N):
    if mask & A[j]:
        ans.append((1,j + 1,index + 1))
print(len(ans))
for t,p,q in ans:
    print(t,p,q)
0