結果
| 問題 | No.365 ジェンガソート | 
| コンテスト | |
| ユーザー |  aka_satana_ha | 
| 提出日時 | 2017-11-25 21:38:13 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                TLE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 364 bytes | 
| コンパイル時間 | 389 ms | 
| コンパイル使用メモリ | 12,416 KB | 
| 実行使用メモリ | 31,404 KB | 
| 最終ジャッジ日時 | 2024-11-27 10:11:16 | 
| 合計ジャッジ時間 | 22,416 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 35 TLE * 6 | 
ソースコード
N=int(input())
a=[int(i) for i in input().split() ]
pos=[None for i in range(N+1)]
for i in range(N):
    pos[a[i]]=i
asc_min=N
for i in reversed(range(1,N)):
    i_pos = pos[i]
    asc=True
    for j in range(i+1,N+1):
        if pos[j]<i_pos:
            asc=False
            break
    if asc==True:
        asc_min=i
    else:
        break
print(asc_min-1)
            
            
            
        