結果

問題 No.711 競技レーティング単調増加
ユーザー nebukuro09nebukuro09
提出日時 2018-07-10 14:26:12
言語 D
(dmd 2.106.1)
結果
WA  
実行時間 -
コード長 811 bytes
コンパイル時間 919 ms
コンパイル使用メモリ 106,064 KB
実行使用メモリ 14,016 KB
最終ジャッジ日時 2023-09-03 20:39:45
合計ジャッジ時間 4,229 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 1 ms
4,380 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 23 ms
7,712 KB
testcase_29 AC 27 ms
8,456 KB
testcase_30 AC 49 ms
11,916 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 57 ms
13,724 KB
testcase_34 AC 51 ms
11,632 KB
testcase_35 AC 60 ms
13,548 KB
testcase_36 AC 18 ms
9,396 KB
testcase_37 WA -
testcase_38 AC 43 ms
11,056 KB
testcase_39 AC 19 ms
6,516 KB
testcase_40 AC 29 ms
9,496 KB
testcase_41 AC 1 ms
4,380 KB
testcase_42 AC 28 ms
7,232 KB
testcase_43 AC 38 ms
9,244 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 int INF = 1 << 29;

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