結果

問題 No.390 最長の数列
ユーザー WagiHOHWagiHOH
提出日時 2016-07-10 17:29:40
言語 D
(dmd 2.106.1)
結果
WA  
実行時間 -
コード長 557 bytes
コンパイル時間 655 ms
コンパイル使用メモリ 93,952 KB
実行使用メモリ 8,880 KB
最終ジャッジ日時 2023-09-02 21:19:51
合計ジャッジ時間 5,016 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
4,372 KB
testcase_01 AC 11 ms
4,372 KB
testcase_02 AC 22 ms
4,368 KB
testcase_03 AC 13 ms
4,368 KB
testcase_04 AC 23 ms
4,368 KB
testcase_05 AC 55 ms
8,332 KB
testcase_06 AC 1,209 ms
8,152 KB
testcase_07 AC 9 ms
4,368 KB
testcase_08 AC 2 ms
4,372 KB
testcase_09 WA -
testcase_10 AC 183 ms
8,880 KB
testcase_11 AC 203 ms
8,236 KB
testcase_12 AC 186 ms
8,056 KB
testcase_13 AC 255 ms
7,928 KB
testcase_14 AC 682 ms
8,456 KB
testcase_15 AC 1 ms
4,368 KB
testcase_16 AC 2 ms
4,368 KB
testcase_17 AC 7 ms
4,372 KB
testcase_18 AC 11 ms
4,372 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio;
import std.algorithm;
import std.string;
import std.conv;
import std.range;

void main()
{
    enum MAX_N = 10 ^^ 5, MAX_X = 10 ^^ 6;
    int[10 ^^ 5] buf;
    immutable n = readln.chomp.to!int;
    readln.splitter.map!(to!int).copy(buf[]);
    auto set = buf[0..n].sort();
    int[int] cache;
    foreach_reverse (x; set) {
        cache[x] = iota(2 * x, MAX_X, x)
                    .filter!(i => set.contains(i))
                    .map!(i => cache[i])
                    .fold!max(0) + 1;
    }
    writeln(cache.values.fold!max);
}
0