結果
| 問題 | No.365 ジェンガソート | 
| コンテスト | |
| ユーザー | 👑  SPD_9X2 | 
| 提出日時 | 2025-07-16 02:07:10 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 372 bytes | 
| コンパイル時間 | 472 ms | 
| コンパイル使用メモリ | 82,700 KB | 
| 実行使用メモリ | 90,708 KB | 
| 最終ジャッジ日時 | 2025-07-16 02:07:16 | 
| 合計ジャッジ時間 | 5,366 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 16 WA * 25 | 
ソースコード
"""
https://yukicoder.me/problems/no/365
"""
import bisect
def LIS(lis):
    seq = []
    for c in lis:
        ind = bisect.bisect_left(seq,c)
        if ind == len(seq):
            seq.append(c)
        else:
            seq[ind] = c
    return len(seq)
N = int(input())
A = list(map(int,input().split()))
print (N - LIS([-A[i] for i in range(N-1,-1,-1)]) )
            
            
            
        