結果

問題 No.711 競技レーティング単調増加
ユーザー maspy
提出日時 2020-03-25 22:35:33
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 625 bytes
コンパイル時間 157 ms
コンパイル使用メモリ 12,160 KB
実行使用メモリ 28,984 KB
最終ジャッジ日時 2025-01-02 00:11:47
合計ジャッジ時間 6,746 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/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)]
print(B)
answer = N - longest_increasing_subsequence(B)
print(answer)
0