結果

問題 No.1604 Swap Sort:ONE
ユーザー ProgrammerryokiProgrammerryoki
提出日時 2021-07-16 21:35:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 99 ms / 2,000 ms
コード長 177 bytes
コンパイル時間 269 ms
コンパイル使用メモリ 87,252 KB
実行使用メモリ 77,080 KB
最終ジャッジ日時 2023-09-20 13:14:50
合計ジャッジ時間 3,759 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,272 KB
testcase_01 AC 76 ms
71,560 KB
testcase_02 AC 73 ms
71,256 KB
testcase_03 AC 74 ms
71,196 KB
testcase_04 AC 73 ms
71,460 KB
testcase_05 AC 96 ms
76,868 KB
testcase_06 AC 89 ms
76,944 KB
testcase_07 AC 95 ms
76,928 KB
testcase_08 AC 97 ms
77,000 KB
testcase_09 AC 97 ms
76,940 KB
testcase_10 AC 97 ms
76,908 KB
testcase_11 AC 97 ms
76,668 KB
testcase_12 AC 99 ms
77,056 KB
testcase_13 AC 97 ms
76,980 KB
testcase_14 AC 97 ms
76,972 KB
testcase_15 AC 96 ms
76,792 KB
testcase_16 AC 98 ms
76,676 KB
testcase_17 AC 88 ms
76,892 KB
testcase_18 AC 87 ms
76,988 KB
testcase_19 AC 95 ms
77,008 KB
testcase_20 AC 86 ms
76,832 KB
testcase_21 AC 96 ms
76,864 KB
testcase_22 AC 91 ms
76,860 KB
testcase_23 AC 76 ms
71,448 KB
testcase_24 AC 73 ms
71,384 KB
testcase_25 AC 97 ms
76,932 KB
testcase_26 AC 89 ms
77,080 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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