結果

問題 No.1896 Arrays and XOR Procedure 2
ユーザー tktk_snsntktk_snsn
提出日時 2022-04-08 23:03:50
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 785 bytes
コンパイル時間 513 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 12,672 KB
最終ジャッジ日時 2024-05-06 08:46:32
合計ジャッジ時間 20,970 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,752 KB
testcase_01 AC 29 ms
10,752 KB
testcase_02 AC 34 ms
10,752 KB
testcase_03 WA -
testcase_04 AC 636 ms
12,160 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 619 ms
11,776 KB
testcase_09 AC 624 ms
11,904 KB
testcase_10 AC 622 ms
11,776 KB
testcase_11 AC 629 ms
11,776 KB
testcase_12 AC 619 ms
11,648 KB
testcase_13 AC 907 ms
12,160 KB
testcase_14 AC 910 ms
12,160 KB
testcase_15 AC 892 ms
12,032 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 122 ms
11,264 KB
testcase_19 AC 56 ms
11,136 KB
testcase_20 AC 195 ms
11,520 KB
testcase_21 AC 57 ms
11,136 KB
testcase_22 AC 312 ms
11,648 KB
testcase_23 AC 329 ms
11,776 KB
testcase_24 AC 328 ms
11,648 KB
testcase_25 AC 322 ms
11,648 KB
testcase_26 AC 336 ms
11,648 KB
testcase_27 AC 318 ms
11,520 KB
testcase_28 AC 485 ms
11,136 KB
testcase_29 AC 512 ms
11,392 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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


# if 0:
#     import random
#     N = 3000
#     A = [random.randint(0, 1 << 30) for _ in range(N)]
#     B = [random.randint(0, 1 << 30) for _ in range(N)]
#     A = list(range(3000))
#     B = [a + 1 << 28 for a in A]
#     A, B = B, A
#     print(A)
#     print(B)

ans = []
while True:
    a = max(A)
    i = A.index(a)
    b = min(B)
    j = B.index(b)

    if a < b:
        break

    if a == b:
        ans.append((1, i + 1, j + 1))
        A[i] ^= B[j]
    else:
        ans.append((2, i + 1, j + 1))
        B[j] ^= A[i]
        ans.append((1, i + 1, j + 1))
        A[i] ^= B[j]
        ans.append((2, i + 1, j + 1))
        B[j] ^= A[i]


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