結果

問題 No.365 ジェンガソート
ユーザー NoNo
提出日時 2017-05-22 00:20:31
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 275 bytes
コンパイル時間 109 ms
コンパイル使用メモリ 11,848 KB
実行使用メモリ 21,768 KB
最終ジャッジ日時 2023-10-19 12:07:30
合計ジャッジ時間 4,146 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,108 KB
testcase_01 AC 28 ms
10,108 KB
testcase_02 AC 29 ms
10,108 KB
testcase_03 WA -
testcase_04 AC 28 ms
10,108 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 28 ms
10,108 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 27 ms
10,108 KB
testcase_11 WA -
testcase_12 AC 28 ms
10,108 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 50 ms
13,672 KB
testcase_21 AC 38 ms
12,592 KB
testcase_22 AC 65 ms
18,260 KB
testcase_23 AC 51 ms
15,472 KB
testcase_24 WA -
testcase_25 AC 39 ms
12,360 KB
testcase_26 AC 55 ms
16,244 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 57 ms
16,784 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 74 ms
21,768 KB
testcase_34 AC 36 ms
11,872 KB
testcase_35 WA -
testcase_36 AC 94 ms
21,604 KB
testcase_37 AC 75 ms
21,612 KB
testcase_38 AC 75 ms
21,604 KB
testcase_39 WA -
testcase_40 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int,input().split()))
s = 0
if a[n - 1] == n:
    s += 1;
t = a[n - 1]
f = True
for i in range(n - 2,-1,-1):
    if a[i] == 1:
        f = True
    if a[i] + 1 == t:
        s += 1
        t = a[i]
        f = False
if f:
    s += 1
print(n - s)
0