結果

問題 No.1896 Arrays and XOR Procedure 2
ユーザー ShirotsumeShirotsume
提出日時 2022-01-02 04:10:32
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,042 bytes
コンパイル時間 359 ms
コンパイル使用メモリ 86,944 KB
実行使用メモリ 79,836 KB
最終ジャッジ日時 2023-09-04 07:09:58
合計ジャッジ時間 12,286 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
72,152 KB
testcase_01 WA -
testcase_02 AC 95 ms
72,244 KB
testcase_03 WA -
testcase_04 AC 154 ms
79,492 KB
testcase_05 AC 154 ms
79,676 KB
testcase_06 AC 155 ms
79,508 KB
testcase_07 AC 156 ms
79,656 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 160 ms
79,628 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 153 ms
79,604 KB
testcase_18 WA -
testcase_19 AC 112 ms
78,760 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 155 ms
78,944 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 154 ms
79,716 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))

MAX = max(max(a), max(b))
ans = []
if a[0] == MAX:
    pass
elif MAX in b:
    p = 0
    q = b.index(MAX)
    ans.append((1, p + 1, q + 1))
    ans.append((2, p + 1, q + 1))
    ans.append((1, p + 1, q + 1))
    a[p], b[q] = b[q], a[p]

elif MAX in a:
    p = a.index(MAX)
    q = 0
    ans.append((1, p + 1, q + 1))
    ans.append((2, p + 1, q + 1))
    ans.append((1, p + 1, q + 1))
    a[p], b[q] = b[q], a[p]
    p = 0
    q = 0
    ans.append((1, p + 1, q + 1))
    ans.append((2, p + 1, q + 1))
    ans.append((1, p + 1, q + 1))
    a[p], b[q] = b[q], a[p]
k = len(bin(MAX)) - 2
for i in range(n):
    if b[i] < pow(2, k - 1):
        ans.append((2, 1, i + 1))
        b[i] = a[0] ^ b[i]
for i in range(n):
    if a[i] >= pow(2, k - 1):
        ans.append((1, i + 1, 1))
        a[i] = a[i] ^ b[0]
for i in range(n):
    for j in range(n):
        assert a[i] < b[j]
import random
print(len(ans) + random.randint(-1, 1))
for v in ans:
    print(*v)
0