結果
| 問題 |
No.54 Happy Hallowe'en
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-06-14 11:03:56 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 810 bytes |
| コンパイル時間 | 816 ms |
| コンパイル使用メモリ | 127,684 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-12 20:03:06 |
| 合計ジャッジ時間 | 2,069 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 18 WA * 1 |
ソースコード
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;
void main() {
auto N = readln.chomp.to!int;
auto K = new Okashi[](N);
foreach (i; 0..N) {
auto s = readln.split.map!(to!int);
K[i] = Okashi(s[0], s[1]);
}
K.sort();
auto dp = new bool[](10001);
dp[0] = true;
int ans = 0;
foreach (i; 0..N) {
foreach (j; iota(K[i].t-1, -1, -1)) {
if (dp[j]) {
ans = max(ans, j + K[i].v);
if (j + K[i].v <= 10000) {
dp[j + K[i].v] = true;
}
}
}
}
ans.writeln;
}