結果

問題 No.1604 Swap Sort:ONE
ユーザー kohei2019kohei2019
提出日時 2022-06-23 00:28:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 94 ms / 2,000 ms
コード長 217 bytes
コンパイル時間 353 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 62,464 KB
最終ジャッジ日時 2024-04-24 04:28:10
合計ジャッジ時間 3,281 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
51,584 KB
testcase_01 AC 42 ms
51,712 KB
testcase_02 AC 41 ms
51,584 KB
testcase_03 AC 40 ms
51,584 KB
testcase_04 AC 41 ms
51,584 KB
testcase_05 AC 65 ms
60,544 KB
testcase_06 AC 63 ms
60,672 KB
testcase_07 AC 87 ms
61,696 KB
testcase_08 AC 87 ms
61,824 KB
testcase_09 AC 88 ms
62,080 KB
testcase_10 AC 87 ms
61,696 KB
testcase_11 AC 87 ms
61,952 KB
testcase_12 AC 87 ms
62,080 KB
testcase_13 AC 93 ms
62,464 KB
testcase_14 AC 89 ms
62,080 KB
testcase_15 AC 88 ms
62,336 KB
testcase_16 AC 94 ms
61,568 KB
testcase_17 AC 67 ms
61,568 KB
testcase_18 AC 67 ms
61,056 KB
testcase_19 AC 85 ms
61,440 KB
testcase_20 AC 63 ms
61,312 KB
testcase_21 AC 84 ms
61,824 KB
testcase_22 AC 77 ms
61,568 KB
testcase_23 AC 53 ms
59,648 KB
testcase_24 AC 51 ms
59,648 KB
testcase_25 AC 84 ms
61,824 KB
testcase_26 AC 71 ms
61,312 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
lsp = list(map(int,input().split()))
cnt = 0
for i in range(N):
    v = i+1
    cnt += lsp[i]-v
    for j in range(i+1,N):
        if lsp[j] < lsp[i]:
            lsp[j] += 1
    lsp[i] = v
print(cnt)
0