結果

問題 No.1604 Swap Sort:ONE
ユーザー Meso Meso
提出日時 2025-04-07 10:13:45
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 985 ms / 2,000 ms
コード長 320 bytes
コンパイル時間 421 ms
コンパイル使用メモリ 12,288 KB
実行使用メモリ 10,496 KB
最終ジャッジ日時 2025-04-07 10:14:00
合計ジャッジ時間 14,307 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

def sort(data):
    cnt = 0
    for i in range(len(data)):
        for j in range(len(data) - i - 1):
            if data[j] > data[j+1]:
                data[j], data[j+1] = data[j+1], data[j]
                cnt += 1

    return cnt
                
n = int(input())
p = list(map(int, input().split()))

print(sort(p))
0