結果
| 問題 | No.365 ジェンガソート | 
| コンテスト | |
| ユーザー |  maspy | 
| 提出日時 | 2020-01-27 17:32:37 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 106 ms / 2,000 ms | 
| コード長 | 354 bytes | 
| コンパイル時間 | 289 ms | 
| コンパイル使用メモリ | 12,672 KB | 
| 実行使用メモリ | 20,088 KB | 
| 最終ジャッジ日時 | 2024-09-14 12:00:37 | 
| 合計ジャッジ時間 | 3,814 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 41 | 
ソースコード
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N,*A = map(int,read().split())
position = [0] * (N+1)
for i,x in enumerate(A):
    position[x] = i
x = 1
for n in range(N-1,0,-1):
    if position[n] < position[n+1]:
        x += 1
    else:
        break
answer = N - x
print(answer)
            
            
            
        