結果

問題 No.1896 Arrays and XOR Procedure 2
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2022-04-08 23:11:17
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 893 bytes
コンパイル時間 317 ms
コンパイル使用メモリ 82,120 KB
実行使用メモリ 77,800 KB
最終ジャッジ日時 2024-05-06 08:55:22
合計ジャッジ時間 6,300 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
52,692 KB
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 AC 76 ms
77,652 KB
testcase_05 WA -
testcase_06 AC 76 ms
77,212 KB
testcase_07 WA -
testcase_08 AC 77 ms
77,800 KB
testcase_09 AC 76 ms
77,408 KB
testcase_10 RE -
testcase_11 WA -
testcase_12 WA -
testcase_13 RE -
testcase_14 WA -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 WA -
testcase_21 WA -
testcase_22 RE -
testcase_23 WA -
testcase_24 WA -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 AC 67 ms
74,548 KB
testcase_29 AC 67 ms
74,836 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

m = 0
aind = -1
for j,a in enumerate(A):
    for i in range(30)[::-1]:
        if a >> i & 1:
            if i > m:
                m = i
                aind = j
a = A[aind]

ans = []
for i in range(n):
    b = B[i]
    if b >> m & 1:
        continue

    nb = b^a
    B[i] = nb
    ans.append([2,aind+1,i+1])

bind = -1

for i in range(n):
    b = B[i]
    ok = 1
    for j in range(30)[::-1]:
        if b >> j & 1:
            if j > m:
                ok = 0
                break
            
            if j == m:
                break
    
    if ok:
        bind = i
        break

if bind != -1:
    b = B[bind]
    for i in range(n):
        a = A[i]
        if a >> m & 1:
            na = a^b
        ans.append([1,i+1,bind+1])
        A[i] = na

print(len(ans))
for i in ans:
    print(*i)
0