結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 76 ms
71,376 KB
testcase_02 AC 78 ms
71,360 KB
testcase_03 AC 173 ms
77,884 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 171 ms
78,068 KB
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 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
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) > max(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