結果

問題 No.711 競技レーティング単調増加
ユーザー gew1fw
提出日時 2025-06-12 18:36:02
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 442 bytes
コンパイル時間 148 ms
コンパイル使用メモリ 82,716 KB
実行使用メモリ 121,268 KB
最終ジャッジ日時 2025-06-12 18:36:17
合計ジャッジ時間 6,165 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24 WA * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect

def main():
    import sys
    input = sys.stdin.read().split()
    N = int(input[0])
    A = list(map(int, input[1:N+1]))
    
    B = [A[i] - (i + 1) for i in range(N)]
    
    tails = []
    for num in B:
        idx = bisect.bisect_right(tails, num)
        if idx == len(tails):
            tails.append(num)
        else:
            tails[idx] = num
    
    print(N - len(tails))

if __name__ == "__main__":
    main()
0