結果

問題 No.711 競技レーティング単調増加
ユーザー nebukuro09nebukuro09
提出日時 2018-07-10 14:26:48
言語 D
(dmd 2.106.1)
結果
AC  
実行時間 60 ms / 2,000 ms
コード長 813 bytes
コンパイル時間 669 ms
コンパイル使用メモリ 106,220 KB
実行使用メモリ 13,768 KB
最終ジャッジ日時 2023-09-03 20:39:55
合計ジャッジ時間 3,678 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 43 ms
9,620 KB
testcase_19 AC 42 ms
10,748 KB
testcase_20 AC 44 ms
9,700 KB
testcase_21 AC 46 ms
10,728 KB
testcase_22 AC 42 ms
10,636 KB
testcase_23 AC 50 ms
13,444 KB
testcase_24 AC 50 ms
13,452 KB
testcase_25 AC 40 ms
9,260 KB
testcase_26 AC 43 ms
9,624 KB
testcase_27 AC 40 ms
10,560 KB
testcase_28 AC 24 ms
7,456 KB
testcase_29 AC 28 ms
8,464 KB
testcase_30 AC 48 ms
10,980 KB
testcase_31 AC 58 ms
13,752 KB
testcase_32 AC 60 ms
13,148 KB
testcase_33 AC 57 ms
13,752 KB
testcase_34 AC 51 ms
11,392 KB
testcase_35 AC 60 ms
13,768 KB
testcase_36 AC 17 ms
8,428 KB
testcase_37 AC 60 ms
12,860 KB
testcase_38 AC 42 ms
11,612 KB
testcase_39 AC 18 ms
6,488 KB
testcase_40 AC 29 ms
7,868 KB
testcase_41 AC 1 ms
4,380 KB
testcase_42 AC 27 ms
7,336 KB
testcase_43 AC 38 ms
9,268 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, std.bitmanip;

immutable long INF = 1L << 60;

void main() {
    auto N = readln.chomp.to!int;
    auto A = readln.split.map!(to!long).array;
    long[] B;
    int ans = 0;

    foreach (i; 0..N) {
        if (A[i] - i > 0) {
            B ~= A[i] - i;
        } else {
            ans += 1;
        }
    }
    
    N = B.length.to!int;
    auto dp = new long[](N+1);
    fill(dp, INF);
    dp[0] = -1;

    foreach (i; 0..N) {
        int lb = dp.assumeSorted.lowerBound(B[i]+1).length.to!int;
        dp[lb] = B[i];
    }


    int tmp = 0;
    foreach (i; 0..N+1) if (dp[i] < INF) tmp = N - i;
    ans += tmp;

    ans.writeln;
}
0