結果
| 問題 |
No.1604 Swap Sort:ONE
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-07-16 21:37:37 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 79 ms / 2,000 ms |
| コード長 | 223 bytes |
| コンパイル時間 | 144 ms |
| コンパイル使用メモリ | 82,428 KB |
| 実行使用メモリ | 63,412 KB |
| 最終ジャッジ日時 | 2024-07-06 08:34:58 |
| 合計ジャッジ時間 | 2,455 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 |
ソースコード
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)