結果

問題 No.1604 Swap Sort:ONE
ユーザー minimumminimum
提出日時 2021-07-16 21:37:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 117 ms / 2,000 ms
コード長 223 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 87,120 KB
実行使用メモリ 76,852 KB
最終ジャッジ日時 2023-09-20 13:18:11
合計ジャッジ時間 4,313 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,364 KB
testcase_01 AC 73 ms
71,384 KB
testcase_02 AC 72 ms
71,500 KB
testcase_03 AC 75 ms
71,156 KB
testcase_04 AC 72 ms
71,276 KB
testcase_05 AC 88 ms
76,644 KB
testcase_06 AC 95 ms
76,576 KB
testcase_07 AC 117 ms
76,436 KB
testcase_08 AC 112 ms
76,568 KB
testcase_09 AC 113 ms
76,464 KB
testcase_10 AC 114 ms
76,340 KB
testcase_11 AC 113 ms
76,568 KB
testcase_12 AC 112 ms
76,576 KB
testcase_13 AC 116 ms
76,588 KB
testcase_14 AC 113 ms
76,496 KB
testcase_15 AC 116 ms
76,708 KB
testcase_16 AC 114 ms
76,276 KB
testcase_17 AC 93 ms
76,436 KB
testcase_18 AC 91 ms
76,732 KB
testcase_19 AC 115 ms
76,564 KB
testcase_20 AC 94 ms
76,824 KB
testcase_21 AC 113 ms
76,408 KB
testcase_22 AC 102 ms
76,852 KB
testcase_23 AC 82 ms
76,364 KB
testcase_24 AC 81 ms
76,192 KB
testcase_25 AC 111 ms
76,744 KB
testcase_26 AC 98 ms
76,768 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int, input().split()))

ans = 0

for i in range(n):
    now = a[i]
    ans += now - i - 1
    a[i] = i + 1
    for j in range(i + 1, n):
        if a[j] < now:
            a[j] += 1

print(ans)
0