結果
| 問題 |
No.2044 Infinite Nim
|
| コンテスト | |
| ユーザー |
ixTL255
|
| 提出日時 | 2023-02-28 23:34:47 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 8 ms / 2,000 ms |
| コード長 | 613 bytes |
| コンパイル時間 | 21,301 ms |
| コンパイル使用メモリ | 384,684 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-16 01:13:00 |
| 合計ジャッジ時間 | 16,845 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 34 |
コンパイルメッセージ
warning: variable does not need to be mutable --> src/main.rs:7:9 | 7 | let mut a = a.trim().split_whitespace() | ----^ | | | help: remove this `mut` | = note: `#[warn(unused_mut)]` on by default
ソースコード
fn main() {
let mut n = String::new();
std::io::stdin().read_line(&mut n).ok();
let _n: usize = n.trim().parse().unwrap();
let mut a = String::new();
std::io::stdin().read_line(&mut a).ok();
let mut a = a.trim().split_whitespace()
.map(|x| x.parse().unwrap()).collect::<Vec<isize>>();
let inf = a.iter().filter(|&&x| x == -1).count();
let norm = a.iter().filter(|&&x| x != -1).fold(0, |x, &y| x ^ y);
println!("{}",
if inf % 2 != 0 {
"First"
} else if norm == 0 {
"Second"
} else {
"First"
}
);
}
ixTL255