結果

問題 No.365 ジェンガソート
コンテスト
ユーザー AEn
提出日時 2022-05-13 23:21:10
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 65 ms / 2,000 ms
コード長 301 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 161 ms
コンパイル使用メモリ 85,284 KB
実行使用メモリ 85,580 KB
最終ジャッジ日時 2026-04-03 07:15:15
合計ジャッジ時間 4,231 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N = int(input())
A = list(map(int, input().split()))
isok = [False]*N
num = N
for i in reversed(range(N)):
    if A[i] == num:
        isok[num-1] = True
        num -= 1

res = 0
for i in reversed(range(N)):
    if isok[i]:
        res += 1
    else:
        print(N-res)
        exit()
print(N-res)
0