結果

問題 No.1604 Swap Sort:ONE
ユーザー NatsubiSoganNatsubiSogan
提出日時 2021-07-16 21:31:26
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 232 bytes
コンパイル時間 370 ms
コンパイル使用メモリ 82,040 KB
実行使用メモリ 76,208 KB
最終ジャッジ日時 2024-07-06 08:26:16
合計ジャッジ時間 4,099 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 3 TLE * 1 -- * 20
権限があれば一括ダウンロードができます

ソースコード

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