結果

問題 No.365 ジェンガソート
ユーザー nanaenanae
提出日時 2017-03-10 00:10:25
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 89 ms / 2,000 ms
コード長 540 bytes
コンパイル時間 93 ms
コンパイル使用メモリ 10,812 KB
実行使用メモリ 19,816 KB
最終ジャッジ日時 2023-09-06 05:39:44
合計ジャッジ時間 3,321 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,800 KB
testcase_01 AC 15 ms
7,844 KB
testcase_02 AC 14 ms
7,864 KB
testcase_03 AC 15 ms
7,868 KB
testcase_04 AC 14 ms
7,972 KB
testcase_05 AC 15 ms
7,952 KB
testcase_06 AC 14 ms
7,788 KB
testcase_07 AC 15 ms
7,788 KB
testcase_08 AC 15 ms
7,776 KB
testcase_09 AC 14 ms
7,940 KB
testcase_10 AC 14 ms
7,788 KB
testcase_11 AC 15 ms
7,904 KB
testcase_12 AC 15 ms
7,864 KB
testcase_13 AC 14 ms
7,856 KB
testcase_14 AC 14 ms
7,768 KB
testcase_15 AC 15 ms
7,824 KB
testcase_16 AC 43 ms
17,044 KB
testcase_17 AC 62 ms
18,968 KB
testcase_18 AC 19 ms
9,148 KB
testcase_19 AC 68 ms
18,948 KB
testcase_20 AC 35 ms
11,828 KB
testcase_21 AC 23 ms
10,628 KB
testcase_22 AC 39 ms
16,292 KB
testcase_23 AC 30 ms
13,292 KB
testcase_24 AC 38 ms
15,780 KB
testcase_25 AC 21 ms
10,332 KB
testcase_26 AC 35 ms
14,372 KB
testcase_27 AC 49 ms
19,472 KB
testcase_28 AC 34 ms
14,724 KB
testcase_29 AC 43 ms
17,928 KB
testcase_30 AC 35 ms
14,888 KB
testcase_31 AC 25 ms
11,200 KB
testcase_32 AC 24 ms
10,940 KB
testcase_33 AC 49 ms
19,240 KB
testcase_34 AC 21 ms
9,976 KB
testcase_35 AC 41 ms
16,508 KB
testcase_36 AC 89 ms
19,604 KB
testcase_37 AC 47 ms
19,732 KB
testcase_38 AC 52 ms
19,620 KB
testcase_39 AC 67 ms
19,816 KB
testcase_40 AC 67 ms
19,776 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

def solve():
    N = int(input())
    A = [int(i) for i in input().split()]

    s = A.index(N)
    nxt = N - 1

    while s > 0:
        for i in range(s - 1, -1, -1):
            if A[i] == nxt:
                s = i
                nxt -= 1
                break
        else:
            s = 0

    print(nxt)

def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None


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