結果

問題 No.1604 Swap Sort:ONE
ユーザー pluto77pluto77
提出日時 2023-03-13 11:11:33
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 147 ms / 2,000 ms
コード長 141 bytes
コンパイル時間 103 ms
コンパイル使用メモリ 11,708 KB
実行使用メモリ 10,328 KB
最終ジャッジ日時 2023-10-18 10:55:42
合計ジャッジ時間 4,303 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
9,948 KB
testcase_01 AC 30 ms
9,948 KB
testcase_02 AC 31 ms
9,948 KB
testcase_03 AC 28 ms
9,948 KB
testcase_04 AC 28 ms
9,948 KB
testcase_05 AC 147 ms
10,296 KB
testcase_06 AC 56 ms
10,296 KB
testcase_07 AC 103 ms
10,312 KB
testcase_08 AC 106 ms
10,312 KB
testcase_09 AC 104 ms
10,312 KB
testcase_10 AC 104 ms
10,308 KB
testcase_11 AC 103 ms
10,308 KB
testcase_12 AC 103 ms
10,308 KB
testcase_13 AC 103 ms
10,312 KB
testcase_14 AC 102 ms
10,328 KB
testcase_15 AC 104 ms
10,312 KB
testcase_16 AC 102 ms
10,328 KB
testcase_17 AC 56 ms
10,164 KB
testcase_18 AC 57 ms
10,168 KB
testcase_19 AC 97 ms
10,292 KB
testcase_20 AC 53 ms
10,152 KB
testcase_21 AC 97 ms
10,292 KB
testcase_22 AC 78 ms
10,236 KB
testcase_23 AC 37 ms
10,052 KB
testcase_24 AC 32 ms
9,996 KB
testcase_25 AC 97 ms
10,300 KB
testcase_26 AC 63 ms
10,188 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
P=list(map(int, input().split()))
res=0
for i in range(N,0,-1):
 ind=P.index(i)
 res+=i-ind-1
 P=P[:ind]+P[ind+1:]
print(res)
0