結果

問題 No.3726 Flawless Flow
コンテスト
ユーザー Kude
提出日時 2026-09-19 14:40:50
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 547 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 64 ms
コンパイル使用メモリ 81,684 KB
実行使用メモリ 84,092 KB
最終ジャッジ日時 2026-09-19 14:41:14
合計ジャッジ時間 6,207 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 48 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
print(*a)
conv = [0] * n
conv_inv = [0] * n
for i in range(n):
    a[i] -= 1
    b[i] -= 1
    conv[b[i]] = i
    conv_inv[i] = b[i]
for i in range(n):
    a[i] = conv[a[i]]

for v in range(n):
    done = [False] * n
    for v in range(n):
        j = a.index(v)
        if j and a[j-1] > a[j] and not done[j-1] and not done[j]:
            done[j-1] = done[j] = True
            a[j-1], a[j] = a[j], a[j-1]
    print(*(conv_inv[a[j]] + 1 for j in range(n)))
0