結果

問題 No.1115 二つの数列 / Two Sequences
ユーザー rei60
提出日時 2020-08-29 12:00:31
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 277 bytes
コンパイル時間 294 ms
コンパイル使用メモリ 82,844 KB
実行使用メモリ 168,132 KB
最終ジャッジ日時 2024-11-14 05:32:10
合計ジャッジ時間 67,037 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 15 TLE * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = {int(x):i for i,x in enumerate(input().split())}
B = list(map(int, input().split()))

exch = 0
for i in range(len(B)-1, 0, -1):
    for j in range(i):
        if A[B[j]] > A[B[j+1]]:
            B[j], B[j+1] = B[j+1], B[j]
            exch += 1
print(exch)
0