結果

問題 No.1896 Arrays and XOR Procedure 2
ユーザー 👑 rin204rin204
提出日時 2022-04-08 22:02:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 72 ms / 2,000 ms
コード長 520 bytes
コンパイル時間 303 ms
コンパイル使用メモリ 82,032 KB
実行使用メモリ 77,072 KB
最終ジャッジ日時 2024-05-06 07:35:27
合計ジャッジ時間 5,794 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
51,968 KB
testcase_01 AC 35 ms
52,480 KB
testcase_02 AC 35 ms
52,352 KB
testcase_03 AC 64 ms
72,320 KB
testcase_04 AC 71 ms
76,672 KB
testcase_05 AC 71 ms
76,800 KB
testcase_06 AC 64 ms
72,832 KB
testcase_07 AC 70 ms
76,672 KB
testcase_08 AC 72 ms
76,672 KB
testcase_09 AC 72 ms
77,056 KB
testcase_10 AC 72 ms
76,672 KB
testcase_11 AC 70 ms
76,892 KB
testcase_12 AC 70 ms
77,072 KB
testcase_13 AC 68 ms
74,880 KB
testcase_14 AC 64 ms
74,240 KB
testcase_15 AC 64 ms
74,496 KB
testcase_16 AC 64 ms
74,624 KB
testcase_17 AC 65 ms
74,368 KB
testcase_18 AC 63 ms
69,632 KB
testcase_19 AC 53 ms
65,024 KB
testcase_20 AC 66 ms
73,088 KB
testcase_21 AC 52 ms
64,128 KB
testcase_22 AC 65 ms
73,728 KB
testcase_23 AC 65 ms
73,884 KB
testcase_24 AC 65 ms
73,856 KB
testcase_25 AC 65 ms
73,216 KB
testcase_26 AC 65 ms
74,624 KB
testcase_27 AC 66 ms
73,728 KB
testcase_28 AC 63 ms
72,192 KB
testcase_29 AC 63 ms
72,576 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans =  []
max_a = max(A)
l = max_a.bit_length() - 1
ind = A.index(max_a) + 1
for i in range(n):
    if not B[i] >> l & 1:
        ans.append((2, ind, i + 1))
        B[i] ^= max_a
        
min_b = min(B)
l = min_b.bit_length() - 1
ind = B.index(min_b) + 1
for i in range(n):
    if A[i] >> l & 1:
        ans.append((1, i + 1, ind))
        A[i] ^= min_b

print(len(ans))
for row in ans:
    print(*row)
    
assert max(A) < min(B)
0