結果

問題 No.1823 Tricolor Dango
ユーザー ikdikd
提出日時 2022-01-28 21:44:01
言語 Rust
(1.72.1)
結果
AC  
実行時間 21 ms / 2,000 ms
コード長 2,733 bytes
コンパイル時間 1,117 ms
コンパイル使用メモリ 152,276 KB
実行使用メモリ 5,808 KB
最終ジャッジ日時 2023-08-28 19:35:05
合計ジャッジ時間 2,879 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 21 ms
4,376 KB
testcase_02 AC 21 ms
4,380 KB
testcase_03 AC 21 ms
4,376 KB
testcase_04 AC 6 ms
4,380 KB
testcase_05 AC 7 ms
4,376 KB
testcase_06 AC 7 ms
4,376 KB
testcase_07 AC 5 ms
4,380 KB
testcase_08 AC 4 ms
4,376 KB
testcase_09 AC 5 ms
4,376 KB
testcase_10 AC 5 ms
4,376 KB
testcase_11 AC 5 ms
4,380 KB
testcase_12 AC 4 ms
4,380 KB
testcase_13 AC 5 ms
4,376 KB
testcase_14 AC 6 ms
4,376 KB
testcase_15 AC 5 ms
4,376 KB
testcase_16 AC 3 ms
4,380 KB
testcase_17 AC 3 ms
4,376 KB
testcase_18 AC 6 ms
4,376 KB
testcase_19 AC 13 ms
5,808 KB
testcase_20 AC 6 ms
4,376 KB
testcase_21 AC 12 ms
4,376 KB
testcase_22 AC 20 ms
4,380 KB
testcase_23 AC 7 ms
4,380 KB
testcase_24 AC 12 ms
4,376 KB
testcase_25 AC 20 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//! # Bundled libraries
//!
//! - `input_i_scanner 0.1.0 (git+https://github.com/ia7ck/rust-competitive-programming#b60dc67706797611e680510aa6492f6397a2e104)` licensed under **missing** as `crate::__cargo_equip::crates::input_i_scanner`

pub use __cargo_equip::prelude::*;

use input_i_scanner::InputIScanner;

fn main() {
    let stdin = std::io::stdin();
    let mut _i_i = InputIScanner::from(stdin.lock());

    macro_rules! scan {
        (($($t: ty),+)) => {
            ($(scan!($t)),+)
        };
        ($t: ty) => {
            _i_i.scan::<$t>() as $t
        };
        (($($t: ty),+); $n: expr) => {
            std::iter::repeat_with(|| scan!(($($t),+))).take($n).collect::<Vec<_>>()
        };
        ($t: ty; $n: expr) => {
            std::iter::repeat_with(|| scan!($t)).take($n).collect::<Vec<_>>()
        };
    }

    let t = scan!(usize);
    for _ in 0..t {
        let n = scan!(usize);
        let a = scan!(u64; n);
        solve(n, a);
    }
}

fn solve(_n: usize, a: Vec<u64>) {
    let tot = a.iter().sum::<u64>();
    let max = a.iter().copied().max().unwrap();
    if tot % 3 == 0 && tot / 3 >= max {
        println!("Yes");
    } else {
        println!("No");
    }
}

// The following code was expanded by `cargo-equip`.

#[rustfmt::skip]
#[allow(unused)]
mod __cargo_equip {
    pub(crate) mod crates {
        pub mod input_i_scanner {use std::fmt;use std::io;use std::str;pub struct InputIScanner<R>{r:R,l:String,i:usize,}impl<R:io::BufRead>InputIScanner<R>{pub fn new(reader:R)->Self{Self{r:reader,l:String::new(),i:0,}}pub fn scan<T>(&mut self)->T where T:str::FromStr,<T as str::FromStr>::Err:fmt::Debug,{self.skip_blanks();assert!(self.i<self.l.len());assert_ne!(&self.l[self.i..=self.i]," ");let rest=&self.l[self.i..];let len=rest.find(' ').unwrap_or_else(| |rest.len());let val=rest[..len].parse().unwrap_or_else(|e|panic!("{:?}, attempt to read `{}`",e,rest));self.i+=len;val}fn skip_blanks(&mut self){loop{match self.l[self.i..].find(|ch|ch!=' '){Some(j)=>{self.i+=j;break;}None=>{let mut buf=String::new();let num_bytes=self.r.read_line(&mut buf).unwrap_or_else(|_|panic!("invalid UTF-8"));assert!(num_bytes>0,"reached EOF :(");self.l=buf.trim_end_matches('\n').trim_end_matches('\r').to_string();self.i=0;}}}}}impl<'a>From<&'a str>for InputIScanner<&'a[u8]>{fn from(s:&'a str)->Self{Self::new(s.as_bytes())}}impl<'a>From<io::StdinLock<'a> >for InputIScanner<io::BufReader<io::StdinLock<'a> > >{fn from(stdin:io::StdinLock<'a>)->Self{Self::new(io::BufReader::new(stdin))}}}
    }

    pub(crate) mod macros {
        pub mod input_i_scanner {}
    }

    pub(crate) mod prelude {pub use crate::__cargo_equip::crates::*;}

    mod preludes {
        pub mod input_i_scanner {}
    }
}
0