結果

問題 No.711 競技レーティング単調増加
ユーザー しらっ亭しらっ亭
提出日時 2017-05-23 00:49:59
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 544 ms / 2,000 ms
コード長 776 bytes
コンパイル時間 101 ms
コンパイル使用メモリ 11,852 KB
実行使用メモリ 33,272 KB
最終ジャッジ日時 2023-10-19 14:25:38
合計ジャッジ時間 13,754 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,132 KB
testcase_01 AC 31 ms
10,132 KB
testcase_02 AC 32 ms
10,132 KB
testcase_03 AC 30 ms
10,136 KB
testcase_04 AC 29 ms
10,136 KB
testcase_05 AC 30 ms
10,136 KB
testcase_06 AC 31 ms
10,136 KB
testcase_07 AC 30 ms
10,136 KB
testcase_08 AC 30 ms
10,136 KB
testcase_09 AC 30 ms
10,136 KB
testcase_10 AC 31 ms
10,136 KB
testcase_11 AC 30 ms
10,136 KB
testcase_12 AC 31 ms
10,136 KB
testcase_13 AC 30 ms
10,136 KB
testcase_14 AC 29 ms
10,132 KB
testcase_15 AC 31 ms
10,136 KB
testcase_16 AC 31 ms
10,136 KB
testcase_17 AC 30 ms
10,136 KB
testcase_18 AC 467 ms
27,644 KB
testcase_19 AC 439 ms
27,760 KB
testcase_20 AC 489 ms
27,176 KB
testcase_21 AC 495 ms
28,960 KB
testcase_22 AC 491 ms
27,572 KB
testcase_23 AC 532 ms
30,096 KB
testcase_24 AC 523 ms
29,884 KB
testcase_25 AC 433 ms
26,428 KB
testcase_26 AC 475 ms
27,784 KB
testcase_27 AC 429 ms
25,496 KB
testcase_28 AC 433 ms
29,116 KB
testcase_29 AC 515 ms
32,756 KB
testcase_30 AC 420 ms
29,080 KB
testcase_31 AC 471 ms
28,676 KB
testcase_32 AC 482 ms
29,820 KB
testcase_33 AC 533 ms
30,976 KB
testcase_34 AC 491 ms
29,452 KB
testcase_35 AC 544 ms
33,272 KB
testcase_36 AC 473 ms
14,092 KB
testcase_37 AC 492 ms
31,148 KB
testcase_38 AC 461 ms
31,916 KB
testcase_39 AC 257 ms
21,636 KB
testcase_40 AC 312 ms
24,820 KB
testcase_41 AC 34 ms
10,132 KB
testcase_42 AC 278 ms
21,628 KB
testcase_43 AC 377 ms
25,696 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# O(n log n) の想定解


def solve():
    n = int(input())
    A = list(map(int, input().split()))

    inf = 10 ** 9 + 7

    dp = [inf] * (n + 1)
    dp[0] = 0

    inc = 0

    for i, a in enumerate(A):
        # インクリメントする前の配列で、j+1 を二分探索する
        lo = -1
        hi = i + 1
        while hi - lo > 1:
            mid = (hi + lo) // 2
            if dp[mid] + inc < a:
                lo = mid
            else:
                hi = mid

        # インクリメント回数
        inc += 1

        # 実際の置き換え
        if lo >= 0:
            dp[lo + 1] = a - inc

    for j in range(n, -1, -1):
        if dp[j] < inf:
            return n - j

    assert False


if __name__ == '__main__':
    print(solve())
0