結果
問題 | No.2723 Fortune-telling by Flowers |
ユーザー |
|
提出日時 | 2024-04-12 22:54:26 |
言語 | Rust (1.83.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,403 bytes |
コンパイル時間 | 12,333 ms |
コンパイル使用メモリ | 397,088 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-02 23:40:20 |
合計ジャッジ時間 | 13,682 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | WA * 13 |
ソースコード
#![allow(unused_imports)]#![allow(unused_variables)]#![allow(non_snake_case)]#![allow(dead_code)]#![allow(unused_macros)]use proconio::{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);}}};}// constantconst 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");}}