結果
問題 | No.710 チーム戦 |
ユーザー | hatoo |
提出日時 | 2018-08-05 19:10:57 |
言語 | Rust (1.77.0 + proconio) |
結果 |
AC
|
実行時間 | 17 ms / 3,000 ms |
コード長 | 3,276 bytes |
コンパイル時間 | 11,254 ms |
コンパイル使用メモリ | 406,360 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-19 18:06:59 |
合計ジャッジ時間 | 12,627 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 3 ms
6,816 KB |
testcase_01 | AC | 3 ms
6,940 KB |
testcase_02 | AC | 16 ms
6,944 KB |
testcase_03 | AC | 16 ms
6,944 KB |
testcase_04 | AC | 17 ms
6,940 KB |
testcase_05 | AC | 15 ms
6,944 KB |
testcase_06 | AC | 16 ms
6,940 KB |
testcase_07 | AC | 15 ms
6,940 KB |
testcase_08 | AC | 15 ms
6,944 KB |
testcase_09 | AC | 16 ms
6,944 KB |
testcase_10 | AC | 16 ms
6,940 KB |
testcase_11 | AC | 16 ms
6,940 KB |
testcase_12 | AC | 16 ms
6,940 KB |
testcase_13 | AC | 16 ms
6,944 KB |
testcase_14 | AC | 16 ms
6,940 KB |
testcase_15 | AC | 16 ms
6,944 KB |
testcase_16 | AC | 15 ms
6,944 KB |
testcase_17 | AC | 16 ms
6,944 KB |
testcase_18 | AC | 15 ms
6,940 KB |
testcase_19 | AC | 16 ms
6,940 KB |
testcase_20 | AC | 17 ms
6,944 KB |
testcase_21 | AC | 17 ms
6,940 KB |
testcase_22 | AC | 16 ms
6,940 KB |
testcase_23 | AC | 15 ms
6,940 KB |
testcase_24 | AC | 15 ms
6,944 KB |
testcase_25 | AC | 2 ms
6,940 KB |
testcase_26 | AC | 2 ms
6,940 KB |
ソースコード
#[doc = " https://github.com/hatoo/competitive-rust-snippets"] #[allow(unused_imports)] use std::cmp::{max, min, Ordering}; #[allow(unused_imports)] use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque}; #[allow(unused_imports)] use std::io::{stdin, stdout, BufWriter, Write}; #[allow(unused_imports)] use std::iter::FromIterator; mod util { use std::fmt::Debug; use std::io::{stdin, stdout, BufWriter, StdoutLock}; use std::str::FromStr; #[allow(dead_code)] pub fn line() -> String { let mut line: String = String::new(); stdin().read_line(&mut line).unwrap(); line.trim().to_string() } #[allow(dead_code)] pub fn chars() -> Vec<char> { line().chars().collect() } #[allow(dead_code)] pub fn gets<T: FromStr>() -> Vec<T> where <T as FromStr>::Err: Debug, { let mut line: String = String::new(); stdin().read_line(&mut line).unwrap(); line.split_whitespace() .map(|t| t.parse().unwrap()) .collect() } #[allow(dead_code)] pub fn with_bufwriter<F: FnOnce(BufWriter<StdoutLock>) -> ()>(f: F) { let out = stdout(); let writer = BufWriter::new(out.lock()); f(writer) } } #[allow(unused_macros)] macro_rules ! get { ( $ t : ty ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; line . trim ( ) . parse ::<$ t > ( ) . unwrap ( ) } } ; ( $ ( $ t : ty ) ,* ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; let mut iter = line . split_whitespace ( ) ; ( $ ( iter . next ( ) . unwrap ( ) . parse ::<$ t > ( ) . unwrap ( ) , ) * ) } } ; ( $ t : ty ; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ ( $ t : ty ) ,*; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( $ ( $ t ) ,* ) ) . collect ::< Vec < _ >> ( ) } ; ( $ t : ty ;; ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; line . split_whitespace ( ) . map ( | t | t . parse ::<$ t > ( ) . unwrap ( ) ) . collect ::< Vec < _ >> ( ) } } ; ( $ t : ty ;; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( $ t ;; ) ) . collect ::< Vec < _ >> ( ) } ; } #[allow(unused_macros)] macro_rules ! debug { ( $ ( $ a : expr ) ,* ) => { eprintln ! ( concat ! ( $ ( stringify ! ( $ a ) , " = {:?}, " ) ,* ) , $ ( $ a ) ,* ) ; } } const BIG_STACK_SIZE: bool = true; #[allow(dead_code)] fn main() { use std::thread; if BIG_STACK_SIZE { thread::Builder::new() .stack_size(32 * 1024 * 1024) .name("solve".into()) .spawn(solve) .unwrap() .join() .unwrap(); } else { solve(); } } #[allow(dead_code)] pub const INF: usize = 1 << 60; fn solve() { let n = get!(usize); let ab = get!(usize, usize; n); let mut dp = vec![0; 100001]; for (a, b) in ab { for i in (0..100001).rev() { dp[i] += b; if i >= a { dp[i] = min(dp[i], dp[i - a]); } } } let ans = (0..100001).map(|i| max(i, dp[i])).min().unwrap(); println!("{}", ans); }