結果

問題 No.1604 Swap Sort:ONE
ユーザー etale.K3
提出日時 2021-07-19 16:41:00
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 144 ms / 2,000 ms
コード長 172 bytes
コンパイル時間 406 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-07-17 13:31:06
合計ジャッジ時間 3,762 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
P = list(map(int, input().split()))

ans = 0

for i in range(N, 0, -1):
    ind = P.index(i)
    ans += i - ind - 1
    P = P[:ind] + P[ind+1:]

print(ans)
0