結果

問題 No.1896 Arrays and XOR Procedure 2
ユーザー 👑 rin204rin204
提出日時 2022-04-08 22:02:10
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 111 ms / 2,000 ms
コード長 520 bytes
コンパイル時間 336 ms
コンパイル使用メモリ 87,236 KB
実行使用メモリ 78,348 KB
最終ジャッジ日時 2023-08-19 00:37:15
合計ジャッジ時間 9,338 ms
ジャッジサーバーID
(参考情報)
judge9 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,536 KB
testcase_01 AC 75 ms
71,448 KB
testcase_02 AC 77 ms
71,292 KB
testcase_03 AC 104 ms
78,096 KB
testcase_04 AC 107 ms
78,084 KB
testcase_05 AC 111 ms
78,020 KB
testcase_06 AC 105 ms
77,920 KB
testcase_07 AC 106 ms
78,108 KB
testcase_08 AC 107 ms
78,276 KB
testcase_09 AC 106 ms
78,348 KB
testcase_10 AC 106 ms
78,108 KB
testcase_11 AC 104 ms
78,112 KB
testcase_12 AC 105 ms
78,344 KB
testcase_13 AC 105 ms
77,952 KB
testcase_14 AC 105 ms
78,068 KB
testcase_15 AC 102 ms
77,940 KB
testcase_16 AC 104 ms
77,988 KB
testcase_17 AC 104 ms
77,992 KB
testcase_18 AC 98 ms
77,140 KB
testcase_19 AC 91 ms
76,840 KB
testcase_20 AC 108 ms
77,920 KB
testcase_21 AC 90 ms
76,584 KB
testcase_22 AC 104 ms
78,032 KB
testcase_23 AC 106 ms
78,188 KB
testcase_24 AC 103 ms
78,020 KB
testcase_25 AC 107 ms
78,092 KB
testcase_26 AC 105 ms
77,920 KB
testcase_27 AC 106 ms
77,924 KB
testcase_28 AC 100 ms
77,848 KB
testcase_29 AC 101 ms
78,176 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