結果
| 問題 |
No.1604 Swap Sort:ONE
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-09-21 10:46:16 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 88 ms / 2,000 ms |
| コード長 | 214 bytes |
| コンパイル時間 | 149 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 63,872 KB |
| 最終ジャッジ日時 | 2024-12-22 04:01:45 |
| 合計ジャッジ時間 | 3,016 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 |
ソースコード
n=int(input())
a=list(map(lambda x : int(x) - 1,input().split()))
ans=0
for i in range(n):
for j in range(i+1,n):
if a[j]==i:
ans+=a[i]-i
if a[j]<a[i]:
a[j]+=1
print(ans)