結果
| 問題 | No.2672 Subset Xor Sum |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-03-15 22:06:19 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,764 bytes |
| 記録 | |
| コンパイル時間 | 13,033 ms |
| コンパイル使用メモリ | 402,032 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-09-30 01:20:06 |
| 合計ジャッジ時間 | 14,152 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 1 |
| other | AC * 46 WA * 20 |
コンパイルメッセージ
warning: unused variable: `N` --> src/main.rs:4:9 | 4 | let N = get!(usize); | ^ help: if this is intentional, prefix it with an underscore: `_N` | = note: `#[warn(unused_variables)]` on by default warning: variable `N` should have a snake case name --> src/main.rs:4:9 | 4 | let N = get!(usize); | ^ help: convert the identifier to snake case: `n` | = note: `#[warn(non_snake_case)]` on by default warning: variable `A` should have a snake case name --> src/main.rs:5:9 | 5 | let A = get!(u16;;); | ^ help: convert the identifier to snake case: `a`
ソースコード
// 5000 < 2^13
fn main() {
let N = get!(usize);
let A = get!(u16;;);
// 総xor
let res = A.iter().fold(0, |acc, x| acc ^ x);
if res == 0 {
println!("Yes");
} else {
println!("No");
}
}
mod get_macro {
//! 入力用マクロ
//! - 参考:[Rustで競技プログラミング スターターキット](https://qiita.com/hatoo@github/items/fa14ad36a1b568d14f3e)
/// 入力用マクロ
#[macro_export]
macro_rules! get {
($t:ty) => {
{
let mut line = String::new();
std::io::stdin().read_line(&mut line).unwrap();
line.trim().parse::<$t>().unwrap()
}
};
($($t:ty),*) => {
{
let mut line = String::new();
std::io::stdin().read_line(&mut line).unwrap();
let mut iter = line.split_whitespace();
(
$(iter.next().unwrap().parse::<$t>().unwrap(),)*
)
}
};
($t:ty ; $n:expr) => {
(0..$n).map(|_|
get_!($t)
).collect::<Vec<_>>()
};
($($t:ty),* ; $n:expr) => {
(0..$n).map(|_|
get_!($($t),*)
).collect::<Vec<_>>()
};
($t:ty ;;) => {
{
let mut line = String::new();
std::io::stdin().read_line(&mut line).unwrap();
line.split_whitespace()
.map(|t| t.parse::<$t>().unwrap())
.collect::<Vec<_>>()
}
};
($t:ty ;; $n:expr) => {
(0..$n).map(|_|
get_!($t ;;)
).collect::<Vec<_>>()
};
}
}