結果

問題 No.1896 Arrays and XOR Procedure 2
ユーザー hir355
提出日時 2022-04-09 01:30:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 430 bytes
コンパイル時間 167 ms
コンパイル使用メモリ 82,292 KB
実行使用メモリ 77,240 KB
最終ジャッジ日時 2024-11-28 19:08:49
合計ジャッジ時間 5,945 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
x = max(a)
mi = a.index(x)
bt = -1
while x > 0:
    x >>= 1
    bt += 1
ans = []
for i in range(n):
    if b[i] & (1 << bt):
        continue
    ans.append((2, mi + 1, i + 1))
    b[i] ^= a[mi]
for i in range(n):
    if a[i] & (1 << bt):
        ans.append((1, i + 1, 1))
        a[i] ^= b[0]
print(len(ans))
for row in ans:
    print(*row)
0