結果

問題 No.365 ジェンガソート
コンテスト
ユーザー UEUEUE66
提出日時 2019-07-17 17:23:03
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
WA  
実行時間 -
コード長 405 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 530 ms
コンパイル使用メモリ 20,824 KB
実行使用メモリ 28,408 KB
最終ジャッジ日時 2026-05-29 00:49:30
合計ジャッジ時間 6,438 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10 WA * 6 TLE * 1 -- * 24
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

def insertion_sort(n, a, c):
    for i in range(n):
        flag = 0
        for j in reversed(range(i)):
            if a[j] > a[j + 1]:
                a[j], a[j + 1] = a[j + 1], a[j]
                flag = 1
            else:
                break
        if flag == 1:
            c += 1
    return c


N = int(input())
A = list(map(int, input().split()))
count = 0

print(insertion_sort(N, A, count))
0