結果

問題 No.216 FAC
コンテスト
ユーザー Tiramister
提出日時 2018-09-02 16:59:07
言語 Rust
(1.92.0 + proconio + num + itertools)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 760 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 25,395 ms
コンパイル使用メモリ 412,852 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2026-01-08 23:50:36
合計ジャッジ時間 27,280 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

use std::io::*;
use std::str::FromStr;

#[allow(dead_code)]
fn get_line() -> String {
    let stdin = stdin();
    let mut line = String::new();
    stdin.lock().read_line(&mut line).expect("io error.");
    line.trim().to_string()
}

#[allow(dead_code)]
fn cast<T: FromStr>(s: &str) -> T {
    s.parse().ok().expect("parse error.")
}

#[allow(dead_code)]
fn get_vec<T: FromStr>() -> Vec<T> {
    (&get_line()).split(' ').map(cast::<T>).collect()
}

fn main() {
    let n: usize = cast(&get_line());
    let a: Vec<u64> = get_vec();
    let b: Vec<usize> = get_vec();

    let mut score = [0u64; 200];
    for i in 0..n {
        score[b[i]] += a[i];
    }

    println!("{}",
        if score[0] >= *(score[1..].iter().max().unwrap()) {"YES"} else {"NO"});
}
0