結果
| 問題 | 
                            No.711 競技レーティング単調増加
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2024-05-07 06:51:04 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 583 bytes | 
| コンパイル時間 | 246 ms | 
| コンパイル使用メモリ | 81,792 KB | 
| 実行使用メモリ | 106,368 KB | 
| 最終ジャッジ日時 | 2024-11-29 21:24:50 | 
| 合計ジャッジ時間 | 6,028 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 14 WA * 27 | 
ソースコード
def find_LIS_length(sequence):
    from bisect import bisect_left
    LIS = []
    for value in sequence:
        pos = bisect_left(LIS, value)
        if pos == len(LIS):
            LIS.append(value)
        else:
            LIS[pos] = value
    return len(LIS)
def minimum_operations_to_strictly_increasing(N, ratings):
    # ratingsは1からNまでの順列であるため、直接LISを求める
    return N - find_LIS_length(ratings)
# 入力
N = int(input())
ratings = list(map(int, input().split()))
# 出力
print(minimum_operations_to_strictly_increasing(N, ratings))