結果

問題 No.231 めぐるはめぐる (1)
ユーザー phsplsphspls
提出日時 2020-02-22 21:02:40
言語 Rust
(1.72.1)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 769 bytes
コンパイル時間 810 ms
コンパイル使用メモリ 143,544 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-07-31 02:03:56
合計ジャッジ時間 1,746 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,384 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

fn main() {
    let mut n = String::new();
    std::io::stdin().read_line(&mut n).ok();
    let n: usize = n.trim().parse().unwrap();
    let mut dangeons: Vec<usize> = vec![];
    for _ in 0..n {
        let mut gd = String::new();
        std::io::stdin().read_line(&mut gd).ok();
        let gd: Vec<usize> = gd.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();
        dangeons.push((gd[0] - gd[1]*30000) * 6)
    }

    let result: Option<usize> = dangeons.iter().enumerate()
        .max_by_key(|pair| pair.1)
        .filter(|pair| *pair.1 >= 3000000)
        .map(|pair| pair.0 + 1);
    if result.is_some() {
        println!("YES");
        (0..6).for_each(|_| { println!("{}", result.unwrap()); });
    } else {
        println!("NO");
    }
}
0