結果

問題 No.365 ジェンガソート
ユーザー MIKI TakushiMIKI Takushi
提出日時 2019-01-04 08:22:17
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 91 ms / 2,000 ms
コード長 286 bytes
コンパイル時間 87 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 20,660 KB
最終ジャッジ日時 2024-05-03 02:41:19
合計ジャッジ時間 3,384 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
10,752 KB
testcase_01 AC 26 ms
10,752 KB
testcase_02 AC 27 ms
10,752 KB
testcase_03 AC 26 ms
10,752 KB
testcase_04 AC 28 ms
10,752 KB
testcase_05 AC 26 ms
10,880 KB
testcase_06 AC 26 ms
10,752 KB
testcase_07 AC 26 ms
10,752 KB
testcase_08 AC 27 ms
10,880 KB
testcase_09 AC 27 ms
10,880 KB
testcase_10 AC 30 ms
10,752 KB
testcase_11 AC 27 ms
10,752 KB
testcase_12 AC 27 ms
10,880 KB
testcase_13 AC 31 ms
10,880 KB
testcase_14 AC 27 ms
10,880 KB
testcase_15 AC 26 ms
10,752 KB
testcase_16 AC 73 ms
18,400 KB
testcase_17 AC 82 ms
20,048 KB
testcase_18 AC 31 ms
11,648 KB
testcase_19 AC 80 ms
19,908 KB
testcase_20 AC 47 ms
13,748 KB
testcase_21 AC 42 ms
13,056 KB
testcase_22 AC 73 ms
18,312 KB
testcase_23 AC 55 ms
15,088 KB
testcase_24 AC 74 ms
17,988 KB
testcase_25 AC 40 ms
12,800 KB
testcase_26 AC 60 ms
16,168 KB
testcase_27 AC 84 ms
20,612 KB
testcase_28 AC 62 ms
16,420 KB
testcase_29 AC 79 ms
19,060 KB
testcase_30 AC 62 ms
16,660 KB
testcase_31 AC 43 ms
13,312 KB
testcase_32 AC 40 ms
13,312 KB
testcase_33 AC 84 ms
20,548 KB
testcase_34 AC 37 ms
12,416 KB
testcase_35 AC 73 ms
18,044 KB
testcase_36 AC 67 ms
20,660 KB
testcase_37 AC 86 ms
20,660 KB
testcase_38 AC 91 ms
20,660 KB
testcase_39 AC 86 ms
20,656 KB
testcase_40 AC 88 ms
20,656 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-
n = int(input())
al = list(map(int, input().split()))

if all([i+1==al[i] for i in range(n)]):
    print(0)
    exit()

cnt = 0
maxN = n
for i in range(n-1,-1,-1):
    # print(i,maxN)
    if al[i]!=maxN:
        cnt += 1
    else:
        maxN -= 1


print(cnt)
0