結果
問題 | No.711 競技レーティング単調増加 |
ユーザー |
|
提出日時 | 2018-07-10 14:26:12 |
言語 | D (dmd 2.109.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 811 bytes |
コンパイル時間 | 764 ms |
コンパイル使用メモリ | 121,080 KB |
実行使用メモリ | 13,404 KB |
最終ジャッジ日時 | 2024-06-13 01:25:05 |
合計ジャッジ時間 | 3,122 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 WA * 21 |
ソースコード
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;}