結果

問題 No.1604 Swap Sort:ONE
ユーザー NatsubiSoganNatsubiSogan
提出日時 2021-07-16 21:31:26
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 232 bytes
コンパイル時間 295 ms
コンパイル使用メモリ 87,128 KB
実行使用メモリ 81,008 KB
最終ジャッジ日時 2023-09-20 13:08:39
合計ジャッジ時間 4,494 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
75,724 KB
testcase_01 AC 76 ms
71,308 KB
testcase_02 AC 76 ms
71,600 KB
testcase_03 AC 75 ms
71,416 KB
testcase_04 AC 76 ms
71,604 KB
testcase_05 AC 79 ms
75,804 KB
testcase_06 TLE -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
p = list(map(int, input().split()))
ans = 0
while True:
    if p == sorted(p): break
    for i in range(1, n):
        a, b = p.index(i), p.index(i + 1)
        if a > b: p[a], p[b] = p[b], p[a]; ans += 1
print(ans)
0