結果
| 問題 | No.710 チーム戦 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2018-06-30 00:16:01 | 
| 言語 | D (dmd 2.109.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 73 ms / 3,000 ms | 
| コード長 | 833 bytes | 
| コンパイル時間 | 894 ms | 
| コンパイル使用メモリ | 122,068 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-06-13 01:16:58 | 
| 合計ジャッジ時間 | 3,227 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 25 | 
ソースコード
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 = 100001;
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);
    fill(dp[0], INF);
    dp[0][0] = 0;
    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;
}
            
            
            
        