結果

問題 No.949 飲酒プログラミングコンテスト
ユーザー pekempeypekempey
提出日時 2019-12-12 01:58:41
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 1,665 bytes
コンパイル時間 3,089 ms
コンパイル使用メモリ 149,920 KB
実行使用メモリ 10,960 KB
最終ジャッジ日時 2023-09-06 13:42:23
合計ジャッジ時間 9,012 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 198 ms
8,048 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 177 ms
5,400 KB
testcase_16 AC 375 ms
8,084 KB
testcase_17 AC 48 ms
4,380 KB
testcase_18 AC 419 ms
10,468 KB
testcase_19 AC 162 ms
5,736 KB
testcase_20 AC 30 ms
4,380 KB
testcase_21 AC 5 ms
4,380 KB
testcase_22 AC 9 ms
4,376 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 230 ms
6,676 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 423 ms
9,928 KB
testcase_28 AC 530 ms
10,944 KB
testcase_29 AC 241 ms
6,956 KB
testcase_30 AC 61 ms
4,380 KB
testcase_31 AC 8 ms
4,380 KB
testcase_32 AC 398 ms
9,924 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#![allow(non_snake_case)]

fn main() {
#[allow(unused_imports)]
    use std::cmp::{min, max};
    use std::io::{Read, Write, BufWriter};
    let mut a = Vec::new();
    std::io::stdin().read_to_end(&mut a).unwrap();
    let a = String::from_utf8(a).unwrap();
    let mut a = a.split_whitespace();
    let mut b = BufWriter::new(std::io::stdout());
    macro_rules! yomu { () => (a.next().unwrap().parse().unwrap()) }
    macro_rules! kaku { ($($arg:tt)*) => (writeln!(b, $($arg)*).unwrap()) }

    let N: usize = yomu!();
    let mut A: Vec<i32> = Vec::new();
    let mut B: Vec<i32> = Vec::new();
    let mut D: Vec<i32> = Vec::new();
    for _ in 0..N+1 { A.push(yomu!()); }
    for _ in 0..N+1 { B.push(yomu!()); }
    for _ in 0..N { D.push(yomu!()); }
    D.sort();
    D.reverse();

    let mut l = 0;
    let mut r = N + 1;
    while r - l > 1 {
        let m: usize = ((l + r) / 2) as usize;
        let mut dp = vec![vec![false; m+1]; m+1];
        dp[0][0] = true;
        for i in 0..m {
            for j in 0..m {
                if i+j+N-m >= N { break }
                if !dp[i][j] { break }
                if A[i+1] + B[j] >= D[N-m+i+j] {
                    dp[i+1][j] = true;
                }
                if A[i] + B[j+1] >= D[N-m+i+j] {
                    dp[i][j+1] = true;
                }
            }
        }
        let mut saidai = 0;
        for i in 0..m+1 {
            for j in 0..m+1 {
                if dp[i][j] {
                    saidai = max(saidai, i+j);
                }
            }
        }
        if saidai == m {
            l = m;
        } else {
            r = m;
        }
    }
    kaku!("{}", l);
}
0