結果

問題 No.1896 Arrays and XOR Procedure 2
ユーザー ShirotsumeShirotsume
提出日時 2021-12-22 11:19:18
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 789 bytes
コンパイル時間 457 ms
コンパイル使用メモリ 87,032 KB
実行使用メモリ 81,760 KB
最終ジャッジ日時 2023-10-14 13:55:32
合計ジャッジ時間 12,258 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
75,984 KB
testcase_01 AC 59 ms
71,424 KB
testcase_02 AC 63 ms
71,316 KB
testcase_03 WA -
testcase_04 AC 156 ms
78,544 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 AC 98 ms
78,352 KB
testcase_19 AC 85 ms
77,116 KB
testcase_20 AC 106 ms
78,284 KB
testcase_21 AC 85 ms
76,868 KB
testcase_22 AC 115 ms
78,464 KB
testcase_23 AC 123 ms
78,612 KB
testcase_24 AC 125 ms
78,436 KB
testcase_25 AC 120 ms
78,392 KB
testcase_26 AC 122 ms
78,244 KB
testcase_27 AC 124 ms
78,524 KB
testcase_28 TLE -
testcase_29 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve(n, a, b):
    ans = []
    c = sorted(a + b)
    minb = c[n]
    while minb in c[0:n] and a.count(minb) > 1:
        q = b.index(minb)
        p = a.index(max(a))
        ans.append((1, p + 1, q + 1))
        ans.append((2, p + 1, q + 1))
        a[p], b[q] = b[q], a[p]
    
    
    while max(a) >= min(b):
        p = a.index(max(a))
        q = b.index(min(b))
        ans.append((1, p + 1, q + 1))
        if max(a) > min(b):
            ans.append((2, p + 1, q + 1))
            ans.append((1, p + 1, q + 1))
            a[p], b[q] = b[q], a[p]
        else:
            a[p] = 0
    return ans
            


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

ans = solve(n, a, b)
print(len(ans))
for t, i, j in ans:
    print(t, i, j)
0