結果

問題 No.1896 Arrays and XOR Procedure 2
ユーザー ShirotsumeShirotsume
提出日時 2021-12-22 11:03:13
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 1,244 bytes
コンパイル時間 798 ms
コンパイル使用メモリ 86,724 KB
実行使用メモリ 81,476 KB
最終ジャッジ日時 2023-10-14 13:55:00
合計ジャッジ時間 12,120 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
71,184 KB
testcase_01 AC 83 ms
71,292 KB
testcase_02 RE -
testcase_03 RE -
testcase_04 AC 191 ms
78,856 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
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 120 ms
78,404 KB
testcase_19 AC 107 ms
77,040 KB
testcase_20 AC 138 ms
78,104 KB
testcase_21 AC 108 ms
77,000 KB
testcase_22 AC 158 ms
78,560 KB
testcase_23 AC 158 ms
78,516 KB
testcase_24 AC 160 ms
78,528 KB
testcase_25 AC 159 ms
78,452 KB
testcase_26 AC 162 ms
78,684 KB
testcase_27 AC 159 ms
78,456 KB
testcase_28 AC 141 ms
77,972 KB
testcase_29 AC 140 ms
78,044 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve(n, a, b):
    ans = []
    c = sorted(a + b)
    minb = c[n]
    if minb in c[0:n - 1] and minb not in a:
        q = b.index(minb)
        p = a.index(max(a))
        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 minb in c[0:n - 1] and minb not in b:
        p = a.index(minb)
        q = b.index(min(b))
        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]
    while minb in a and minb in b:
        p = a.index(minb)
        q = b.index(minb)
        ans.append((1, p + 1, q + 1))
        a[p] = 0
    while max(a) > min(b):
        p = a.index(max(a))
        q = b.index(min(b))
        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]

    for i in range(n):
        for j in range(n):
            if a[i] >= b[j]:
                raise Exception
    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