結果

問題 No.365 ジェンガソート
ユーザー sue_charo
提出日時 2017-04-13 18:40:40
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 605 bytes
コンパイル時間 107 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 24,860 KB
最終ジャッジ日時 2024-07-18 12:56:33
合計ジャッジ時間 4,318 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14 WA * 2 TLE * 1 -- * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

# 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