結果
| 問題 | No.1072 A Nice XOR Pair |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-01-23 12:07:18 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 871 bytes |
| 記録 | |
| コンパイル時間 | 14,230 ms |
| コンパイル使用メモリ | 384,312 KB |
| 実行使用メモリ | 13,644 KB |
| 最終ジャッジ日時 | 2024-11-29 10:21:51 |
| 合計ジャッジ時間 | 33,299 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 4 WA * 1 TLE * 6 |
ソースコード
#[macro_export]
macro_rules! setup {
{ mut $input:ident: SplitWhitespace $(,)? } => {
use std::io::Read;
let mut buf = String::new();
std::io::stdin().read_to_string(&mut buf).ok();
let mut $input = buf.split_whitespace();
};
}
#[macro_export]
macro_rules! parse_next {
($str_iter:expr) => {
$str_iter.next().unwrap().parse().ok().unwrap()
};
}
fn main() {
setup! { mut input: SplitWhitespace };
let n: usize = parse_next!(input);
let x: usize = parse_next!(input);
let a: Vec<usize> = (0..n).map(|_| parse_next!(input)).collect();
let ans = (|| {
let mut count = 0;
for i in 0..n {
for j in i..n {
if a[i] ^ a[j] == x {
count += 1;
}
}
}
count
})();
println!("{}", ans);
}