結果

問題 No.365 ジェンガソート
コンテスト
ユーザー sue_charo
提出日時 2017-04-13 18:40:40
言語 Python3
(3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
WA  
実行時間 -
コード長 605 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 293 ms
コンパイル使用メモリ 21,540 KB
実行使用メモリ 21,504 KB
最終ジャッジ日時 2026-08-17 04:08:34
合計ジャッジ時間 6,459 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14 WA * 2 TLE * 1 -- * 24
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

# coding: utf-8
from collections import deque

N = int(input())
a = deque(list(map(int, input().split())))

ans = 0

do_bool = True
while do_bool:
    now_num = a[0]
    for i in range(1, N):
        if now_num <= a[i]:
            now_num = a[i]
        if now_num > a[i]:
            max_num = a[i]
            for j in range(i, N):
                if a[j] < now_num:
                    max_num = max(max_num, a[j])

            change_num = max_num
            a.remove(max_num)
            a.appendleft(change_num)
            ans += 1
            break
    else:
        do_bool = False

print(ans)
0