結果

問題 No.1208 anti primenumber game
ユーザー tonyu0
提出日時 2020-08-30 16:42:31
言語 Rust
(1.83.0 + proconio)
結果
WA  
実行時間 -
コード長 1,073 bytes
コンパイル時間 14,836 ms
コンパイル使用メモリ 381,824 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-15 11:24:52
合計ジャッジ時間 16,479 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 34 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::*;
fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let m: i64 = itr.next().unwrap().parse().unwrap();
    let a: Vec<i64> = (0..n)
        .map(|_| itr.next().unwrap().parse().unwrap())
        .collect();

    let mut parity = 0; // その山を見たときどっちのターンか
    let mut score1 = 0i64;
    let mut score2 = 0i64;
    for &e in a.iter() {
        if parity & 1 == 0 {
            if e == 1 {
                score1 += 1 - m;
                parity ^= 1;
            } else {
                score1 += e - 1;
                score2 += 1 - m;
            }
        } else {
            if e == 1 {
                score2 += 1 - m;
                parity ^= 1;
            } else {
                score2 += e - 1;
                score1 += 1 - m;
            }
        }
    }
    if score1 > score2 {
        println!("First");
    } else {
        println!("Second");
    }
}
0