結果

問題 No.711 競技レーティング単調増加
ユーザー vwxyzvwxyz
提出日時 2022-07-16 02:15:40
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 292 ms / 2,000 ms
コード長 1,350 bytes
コンパイル時間 122 ms
コンパイル使用メモリ 10,960 KB
実行使用メモリ 38,852 KB
最終ジャッジ日時 2023-09-10 09:03:37
合計ジャッジ時間 8,754 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
10,516 KB
testcase_01 AC 34 ms
10,400 KB
testcase_02 AC 35 ms
10,464 KB
testcase_03 AC 33 ms
10,408 KB
testcase_04 AC 34 ms
10,480 KB
testcase_05 AC 33 ms
10,484 KB
testcase_06 AC 34 ms
10,512 KB
testcase_07 AC 33 ms
10,416 KB
testcase_08 AC 34 ms
10,520 KB
testcase_09 AC 34 ms
10,408 KB
testcase_10 AC 34 ms
10,468 KB
testcase_11 AC 33 ms
10,464 KB
testcase_12 AC 34 ms
10,512 KB
testcase_13 AC 34 ms
10,488 KB
testcase_14 AC 34 ms
10,480 KB
testcase_15 AC 34 ms
10,520 KB
testcase_16 AC 33 ms
10,408 KB
testcase_17 AC 34 ms
10,416 KB
testcase_18 AC 193 ms
28,012 KB
testcase_19 AC 182 ms
27,232 KB
testcase_20 AC 198 ms
27,336 KB
testcase_21 AC 205 ms
28,124 KB
testcase_22 AC 190 ms
27,868 KB
testcase_23 AC 213 ms
30,480 KB
testcase_24 AC 209 ms
30,196 KB
testcase_25 AC 175 ms
26,812 KB
testcase_26 AC 195 ms
28,248 KB
testcase_27 AC 179 ms
25,824 KB
testcase_28 AC 114 ms
29,284 KB
testcase_29 AC 127 ms
32,148 KB
testcase_30 AC 253 ms
30,760 KB
testcase_31 AC 260 ms
32,320 KB
testcase_32 AC 272 ms
33,980 KB
testcase_33 AC 281 ms
36,272 KB
testcase_34 AC 265 ms
34,300 KB
testcase_35 AC 286 ms
38,852 KB
testcase_36 AC 103 ms
18,324 KB
testcase_37 AC 292 ms
34,632 KB
testcase_38 AC 275 ms
33,840 KB
testcase_39 AC 118 ms
21,864 KB
testcase_40 AC 165 ms
24,376 KB
testcase_41 AC 34 ms
10,564 KB
testcase_42 AC 160 ms
23,312 KB
testcase_43 AC 213 ms
31,680 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
import copy
import decimal
import fractions
import heapq
import itertools
import math
import random
import sys
import time
from collections import Counter,deque,defaultdict
from functools import lru_cache,reduce
from heapq import heappush,heappop,heapify,heappushpop,_heappop_max,_heapify_max
def _heappush_max(heap,item):
    heap.append(item)
    heapq._siftdown_max(heap, 0, len(heap)-1)
def _heappushpop_max(heap, item):
    if heap and item < heap[0]:
        item, heap[0] = heap[0], item
        heapq._siftup_max(heap, 0)
    return item
from math import gcd as GCD
read=sys.stdin.read
readline=sys.stdin.readline
readlines=sys.stdin.readlines

def LIS(lst,weakly=False,inf=float('inf'),restoration=False):
    f=bisect.bisect_right if weakly else bisect.bisect_left
    N=len(lst)
    update=[None]*N
    dp=[inf]*N
    for k,x in enumerate(lst):
        i=f(dp,x)
        dp[i]=x
        update[k]=(i,dp[i])
    len_lis=bisect.bisect_left(dp,inf)
    if restoration:
        lis=[None]*len_lis
        len_lis-=1
        for i,x in update[::-1]:
            if i==len_lis:
                lis[len_lis]=x
                len_lis-=1
        return lis
    else:
        return len_lis

N=int(readline())
A=list(map(int,readline().split()))
for i in range(N):
    A[i]-=i
ans=N-LIS([a for a in A if a>=1],weakly=True)
print(ans)
0