結果

問題 No.365 ジェンガソート
ユーザー けむけむけむけむ
提出日時 2021-07-11 13:53:02
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 64 ms / 2,000 ms
コード長 616 bytes
コンパイル時間 108 ms
コンパイル使用メモリ 10,796 KB
実行使用メモリ 20,184 KB
最終ジャッジ日時 2023-09-14 20:09:24
合計ジャッジ時間 3,777 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,592 KB
testcase_01 AC 18 ms
8,436 KB
testcase_02 AC 18 ms
8,500 KB
testcase_03 AC 18 ms
8,500 KB
testcase_04 AC 19 ms
8,596 KB
testcase_05 AC 18 ms
8,572 KB
testcase_06 AC 18 ms
8,516 KB
testcase_07 AC 18 ms
8,568 KB
testcase_08 AC 18 ms
8,500 KB
testcase_09 AC 18 ms
8,636 KB
testcase_10 AC 18 ms
8,568 KB
testcase_11 AC 19 ms
8,588 KB
testcase_12 AC 18 ms
8,660 KB
testcase_13 AC 19 ms
8,532 KB
testcase_14 AC 19 ms
8,656 KB
testcase_15 AC 19 ms
8,568 KB
testcase_16 AC 47 ms
17,624 KB
testcase_17 AC 58 ms
19,376 KB
testcase_18 AC 22 ms
9,520 KB
testcase_19 AC 58 ms
19,156 KB
testcase_20 AC 33 ms
12,244 KB
testcase_21 AC 27 ms
11,096 KB
testcase_22 AC 46 ms
17,344 KB
testcase_23 AC 34 ms
13,872 KB
testcase_24 AC 44 ms
16,700 KB
testcase_25 AC 26 ms
10,844 KB
testcase_26 AC 39 ms
14,800 KB
testcase_27 AC 56 ms
20,016 KB
testcase_28 AC 40 ms
15,540 KB
testcase_29 AC 51 ms
18,168 KB
testcase_30 AC 41 ms
15,212 KB
testcase_31 AC 28 ms
11,544 KB
testcase_32 AC 28 ms
11,204 KB
testcase_33 AC 54 ms
20,184 KB
testcase_34 AC 25 ms
10,292 KB
testcase_35 AC 46 ms
16,768 KB
testcase_36 AC 64 ms
19,880 KB
testcase_37 AC 56 ms
19,960 KB
testcase_38 AC 56 ms
19,812 KB
testcase_39 AC 60 ms
19,808 KB
testcase_40 AC 60 ms
19,896 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

def sousa(N, li):
    pasd = deque()
    movd = deque()
    pasd.append(li[0])
    for i in range(1, len(li)):
        if li[i] < pasd[-1]:
            movd.append(li[i])
        elif li[i] == pasd[-1] + 1:
            pasd.append(li[i])
        elif li[i] > pasd[-1] + 1:
            for j in range(len(pasd)):
                movd.append(pasd[j])
            pasd = deque()
            pasd.append(li[i])
    result = len(movd)
    return result

def main():
    N = int(input())
    li = list(map(int, input().split()))
    print(sousa(N, li))

if __name__ == '__main__':
    main()
0