結果

問題 No.1604 Swap Sort:ONE
ユーザー tonyu0tonyu0
提出日時 2022-09-21 10:46:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 126 ms / 2,000 ms
コード長 214 bytes
コンパイル時間 294 ms
コンパイル使用メモリ 87,084 KB
実行使用メモリ 76,716 KB
最終ジャッジ日時 2023-08-23 19:53:50
合計ジャッジ時間 5,176 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,448 KB
testcase_01 AC 75 ms
71,220 KB
testcase_02 AC 75 ms
71,256 KB
testcase_03 AC 81 ms
71,208 KB
testcase_04 AC 79 ms
71,196 KB
testcase_05 AC 93 ms
76,456 KB
testcase_06 AC 98 ms
76,320 KB
testcase_07 AC 125 ms
76,492 KB
testcase_08 AC 125 ms
76,320 KB
testcase_09 AC 125 ms
76,712 KB
testcase_10 AC 124 ms
76,576 KB
testcase_11 AC 126 ms
76,716 KB
testcase_12 AC 126 ms
76,444 KB
testcase_13 AC 125 ms
76,508 KB
testcase_14 AC 123 ms
76,608 KB
testcase_15 AC 126 ms
76,496 KB
testcase_16 AC 124 ms
76,564 KB
testcase_17 AC 99 ms
76,296 KB
testcase_18 AC 100 ms
76,200 KB
testcase_19 AC 123 ms
76,492 KB
testcase_20 AC 97 ms
76,468 KB
testcase_21 AC 120 ms
76,432 KB
testcase_22 AC 110 ms
76,576 KB
testcase_23 AC 89 ms
76,172 KB
testcase_24 AC 86 ms
76,220 KB
testcase_25 AC 121 ms
76,312 KB
testcase_26 AC 103 ms
76,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0