結果
問題 | No.711 競技レーティング単調増加 |
ユーザー |
![]() |
提出日時 | 2020-03-25 22:36:32 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 173 ms / 2,000 ms |
コード長 | 617 bytes |
コンパイル時間 | 284 ms |
コンパイル使用メモリ | 12,032 KB |
実行使用メモリ | 28,784 KB |
最終ジャッジ日時 | 2025-01-02 00:12:10 |
合計ジャッジ時間 | 6,215 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 41 |
ソースコード
#!/usr/bin/ python3.8 import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N, *A = map(int, read().split()) def longest_increasing_subsequence(seq, wider_sense=True): from bisect import bisect_left, bisect_right f = bisect_right if wider_sense else bisect_left N = len(seq) INF = 10**18 dp = [INF] * (N + 1) for x in seq: if x <= 0: continue i = f(dp, x) dp[i] = x return f(dp, INF - 1) B = [x - i for i, x in enumerate(A)] answer = N - longest_increasing_subsequence(B) print(answer)