結果
| 問題 |
No.2723 Fortune-telling by Flowers
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-04-12 22:54:01 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,412 bytes |
| コンパイル時間 | 10,954 ms |
| コンパイル使用メモリ | 398,824 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-10-02 23:40:00 |
| 合計ジャッジ時間 | 12,173 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | WA * 13 |
ソースコード
#![allow(unused_imports)]
#![allow(unused_variables)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
use proconio::{
fastout, input,
marker::{Bytes, Chars, Usize1},
};
macro_rules! debug {
( $($val:expr),* $(,)* ) => {{
#[cfg(debug_assertions)]
eprintln!( concat!($(stringify!($val), " = {:?}, "),*), $($val),* );
}};
}
macro_rules! debug2D {
( $array:expr ) => {{
#![cfg(debug_assertions)]
eprintln!("{}: ", stringify!($array));
for row in &$array {
eprintln!("{:?}", row);
}
}};
}
// constant
const MOD1: usize = 1_000_000_007;
const MOD9: usize = 998_244_353;
const INF: usize = 1001001001001001001;
fn main() {
input! {
T: usize,
}
for _ in 0..T {
solve();
}
}
fn solve() {
input! {
N: usize,
S: String,
}
// K, Pそれぞれのnim和
let (nimK, nimP) = S
.split('-')
.map(|s| {
let mut cnt = (0_usize, 0_usize);
for c in s.chars() {
if c == 'K' {
cnt.0 += 1;
} else {
cnt.1 += 1;
}
}
cnt
})
.fold((0, 0), |(k, p), (a, b)| (k ^ a, p ^ b));
debug!(nimK, nimP);
if nimK ^ nimP == 0 {
println!("P");
} else {
println!("K");
}
}