結果
| 問題 | No.3120 Lower Nim |
| コンテスト | |
| ユーザー |
lumc_
|
| 提出日時 | 2025-04-20 12:13:45 |
| 言語 | Rust (1.99.1 + proconio + num + itertools + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 425 ms / 2,000 ms |
| + 999µs | |
| コード長 | 1,918 bytes |
| 記録 | |
| コンパイル時間 | 8,063 ms |
| コンパイル使用メモリ | 169,748 KB |
| 実行使用メモリ | 6,272 KB |
| 平均クエリ数 | 2626.27 |
| 最終ジャッジ日時 | 2026-11-05 01:53:49 |
| 合計ジャッジ時間 | 15,184 ms |
|
ジャッジサーバーID (参考情報) |
judge7_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 44 |
ソースコード
#![allow(
dead_code,
non_snake_case,
unused_imports,
unused_mut,
unused_variables,
while_true,
unused_assignments,
clippy::needless_range_loop,
clippy::ptr_arg,
clippy::type_complexity,
clippy::unnecessary_cast
)]
use proconio::{
input,
marker::{Chars, Usize1 as usize1},
source::line::LineSource,
};
use std::collections::{BinaryHeap, HashMap, HashSet, VecDeque};
type Memo = HashMap<usize, HashMap<Option<usize>, i64>>;
use std::collections::BTreeSet;
use std::io::{BufReader, Write, stdin, stdout};
fn lsb(x: u64) -> u64 {
x & (x.wrapping_neg())
}
fn main() {
let stdin = stdin();
let mut source = LineSource::new(BufReader::new(stdin.lock()));
input! {
from &mut source,
N: usize,
mut A: [u64; N],
};
let mut c = 0;
let mut K = 2;
let mut A_xor_sum = A.iter().fold(0, |acc, &x| acc ^ x);
macro_rules! read {
() => {
input! {
from &mut source,
i: usize1, x: u64,
stat: usize,
};
if K != x {
K = x;
c = 0;
}
A_xor_sum ^= A[i];
A[i] -= x;
A_xor_sum ^= A[i];
if stat != 0 {
return;
}
K = lsb(A_xor_sum);
};
}
if A_xor_sum == 0 {
println!("Second");
stdout().flush().unwrap();
read!();
} else {
println!("First");
K = lsb(A_xor_sum);
}
loop {
while A[c] < K {
c += 1;
}
println!("{} {}", c + 1, K);
A_xor_sum ^= A[c];
A[c] -= K;
A_xor_sum ^= A[c];
stdout().flush().unwrap();
input! {
from &mut source,
stat: usize,
}
if stat != 0 {
return;
}
read!();
}
}
lumc_