結果

問題 No.2812 Plus Minus Blackboard
ユーザー sakikuroesakikuroe
提出日時 2024-07-19 22:10:04
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 665 bytes
コンパイル時間 16,153 ms
コンパイル使用メモリ 390,312 KB
実行使用メモリ 17,024 KB
最終ジャッジ日時 2024-07-19 22:10:32
合計ジャッジ時間 18,714 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,248 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 WA -
testcase_04 AC 62 ms
10,368 KB
testcase_05 AC 113 ms
17,024 KB
testcase_06 WA -
testcase_07 AC 13 ms
5,376 KB
testcase_08 AC 11 ms
5,376 KB
testcase_09 AC 93 ms
13,952 KB
testcase_10 WA -
testcase_11 AC 59 ms
9,728 KB
testcase_12 AC 43 ms
7,808 KB
testcase_13 AC 113 ms
16,512 KB
testcase_14 AC 26 ms
5,504 KB
testcase_15 AC 8 ms
5,376 KB
testcase_16 AC 102 ms
14,976 KB
testcase_17 WA -
testcase_18 AC 18 ms
5,376 KB
testcase_19 AC 80 ms
12,416 KB
testcase_20 AC 9 ms
5,376 KB
testcase_21 AC 108 ms
16,512 KB
testcase_22 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

use proconio::{fastout, input};
use std::collections::BTreeSet;

#[fastout]
fn main() {
    input! {
        n: usize,
        a: [i64; n],
    }

    let mut set = BTreeSet::new();

    let mut t = 0;

    for i in 0..n {
        set.insert((a[i], t));
        t += 1;
    }

    for _ in 0..n - 1 {
        let x = set.range((0, 0)..).next();
        if x.is_none() {
            println!("No");
            return;
        }

        let y = set.range(..=(0, i32::MAX)).next();
        if y.is_none() {
            println!("No");
            return;
        }

        set.insert((x.unwrap().0 + y.unwrap().0, t));
        t += 1;
    }

    println!("Yes");
}
0