結果

問題 No.54 Happy Hallowe'en
ユーザー nebukuro09nebukuro09
提出日時 2017-03-17 11:56:26
言語 D
(dmd 2.106.1)
結果
WA  
実行時間 -
コード長 656 bytes
コンパイル時間 1,928 ms
コンパイル使用メモリ 112,852 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-03 12:23:08
合計ジャッジ時間 7,390 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,384 KB
testcase_02 WA -
testcase_03 AC 1 ms
4,380 KB
testcase_04 TLE -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
権限があれば一括ダウンロードができます

ソースコード

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, core.stdc.stdio;

alias Tuple!(int , "v", int, "t") Okashi; 

int N;
Okashi[] VT;
int[int][10010] mem;

int dp(int n, int v) {
    if (n >= N) return v;
    if (v >= VT[n].t) return v;
    else return max(dp(n+1, v), dp(n+1, v+VT[n].v));
    
}

void main() {
    N = readln.chomp.to!int;
    VT = new Okashi[](N);
    foreach (i; 0..N) {
        auto s = readln.split.map!(to!int);
        VT[i] = Okashi(s[0], s[1]);
    }

    VT.sort!"a.t < b.t"();
    dp(0, 0).writeln;
}
0