結果
| 問題 |
No.710 チーム戦
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-06-30 00:09:45 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 792 bytes |
| コンパイル時間 | 1,071 ms |
| コンパイル使用メモリ | 119,808 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-13 01:16:47 |
| 合計ジャッジ時間 | 2,256 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 3 WA * 22 |
ソースコード
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 MAX = 10001;
immutable int INF = 1 << 29;
void main() {
auto N = readln.chomp.to!int;
auto V = N.iota.map!(_ => readln.split.map!(to!int).array).array;
auto dp = new int[][](2, MAX);
int cur = 0, tar = 1;
foreach (i; 0..N) {
fill(dp[tar], INF);
foreach (j; 0..MAX) {
dp[tar][j] = min(dp[tar][j], dp[cur][j] + V[i][1]);
if (j + V[i][0] < MAX)
dp[tar][j+V[i][0]] = min(dp[tar][j+V[i][0]], dp[cur][j]);
}
swap(cur, tar);
}
MAX.iota.map!(i => max(i, dp[cur][i])).reduce!min.writeln;
}