結果
問題 |
No.54 Happy Hallowe'en
|
ユーザー |
|
提出日時 | 2017-03-17 11:56:26 |
言語 | D (dmd 2.109.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 656 bytes |
コンパイル時間 | 836 ms |
コンパイル使用メモリ | 127,380 KB |
実行使用メモリ | 9,884 KB |
最終ジャッジ日時 | 2024-06-12 18:22:50 |
合計ジャッジ時間 | 7,293 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 3 WA * 1 TLE * 1 -- * 14 |
ソースコード
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; }