結果

問題 No.1604 Swap Sort:ONE
ユーザー etale.K3etale.K3
提出日時 2021-07-19 16:41:00
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 94 ms / 2,000 ms
コード長 172 bytes
コンパイル時間 170 ms
コンパイル使用メモリ 10,692 KB
実行使用メモリ 8,612 KB
最終ジャッジ日時 2023-09-24 12:35:54
合計ジャッジ時間 3,556 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
7,952 KB
testcase_01 AC 13 ms
7,852 KB
testcase_02 AC 14 ms
7,852 KB
testcase_03 AC 15 ms
7,952 KB
testcase_04 AC 15 ms
7,956 KB
testcase_05 AC 94 ms
8,228 KB
testcase_06 AC 36 ms
8,244 KB
testcase_07 AC 65 ms
8,472 KB
testcase_08 AC 66 ms
8,412 KB
testcase_09 AC 68 ms
8,516 KB
testcase_10 AC 72 ms
8,540 KB
testcase_11 AC 67 ms
8,540 KB
testcase_12 AC 66 ms
8,408 KB
testcase_13 AC 64 ms
8,504 KB
testcase_14 AC 65 ms
8,304 KB
testcase_15 AC 67 ms
8,612 KB
testcase_16 AC 69 ms
8,500 KB
testcase_17 AC 34 ms
8,292 KB
testcase_18 AC 35 ms
8,348 KB
testcase_19 AC 62 ms
8,552 KB
testcase_20 AC 31 ms
8,348 KB
testcase_21 AC 62 ms
8,484 KB
testcase_22 AC 51 ms
8,352 KB
testcase_23 AC 20 ms
7,908 KB
testcase_24 AC 16 ms
7,880 KB
testcase_25 AC 61 ms
8,456 KB
testcase_26 AC 40 ms
8,288 KB
権限があれば一括ダウンロードができます

ソースコード

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