結果
| 問題 |
No.3323 岩井星式ジャンケン
|
| コンテスト | |
| ユーザー |
おもち(求肥)
|
| 提出日時 | 2025-11-01 15:54:07 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,356 bytes |
| コンパイル時間 | 12,323 ms |
| コンパイル使用メモリ | 399,604 KB |
| 実行使用メモリ | 8,192 KB |
| 最終ジャッジ日時 | 2025-11-01 15:54:23 |
| 合計ジャッジ時間 | 14,377 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 6 WA * 20 |
ソースコード
use std::collections::HashSet;
use proconio::input;
use proconio::marker::Chars;
fn main() {
input!{
n: usize,
m: usize,
s: [Chars; n]
}
let mut ans = vec![];
let mut remain = vec![0; n];
for i in 0..n {
remain[i] = i;
}
for i in 0..m {
let mut hands = HashSet::new();
for &j in &remain {
hands.insert(s[j][i]);
}
if hands.len() == 3 {
println!("-1");
return;
}
if hands.len() == 2 {
if !hands.contains(&'G') {
remain = remain.into_iter().filter(|&h| s[h][i] == 'C').collect();
ans.push('C');
}
if !hands.contains(&'C') {
remain = remain.into_iter().filter(|&h| s[h][i] == 'P').collect();
ans.push('P');
}
if !hands.contains(&'P') {
remain = remain.into_iter().filter(|&h| s[h][i] == 'G').collect();
ans.push('G');
}
}
if hands.len() == 1 {
if hands.contains(&'G') { ans.push('P'); break;}
if hands.contains(&'C') { ans.push('G'); break;}
if hands.contains(&'P') { ans.push('C'); break;}
}
}
println!("{}", ans.iter().fold(String::new(), |mut acc, &c| {acc.push(c); acc}));
}
おもち(求肥)