結果
問題 | No.239 にゃんぱすー |
ユーザー |
|
提出日時 | 2019-10-20 09:23:54 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,016 bytes |
コンパイル時間 | 10,752 ms |
コンパイル使用メモリ | 395,508 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-02 17:23:33 |
合計ジャッジ時間 | 11,976 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 33 |
ソースコード
fn getline() -> String {let mut __ret = String::new();std::io::stdin().read_line(&mut __ret).ok();return __ret;}fn main() {let n: usize = getline().trim().parse().unwrap();let mut nyanpass_count_vector = [0; 100];for _ in 0..n {let line = getline();let greetings: Vec<_> = line.trim().split(' ').collect();for j in 0..n {let greeting = greetings[j];if greeting == "nyanpass" {nyanpass_count_vector[j] += 1;}}}let mut nyanpass_resident_number: i32 = -1;let mut nyanpass_resident_candidate_count = 0;for i in 0..nyanpass_count_vector.len() {if nyanpass_count_vector[i] == n as i32 - 1 {nyanpass_resident_number = i as i32;nyanpass_resident_candidate_count += 1;}}if nyanpass_resident_candidate_count == 1 && n > 2 {println!("{}", nyanpass_resident_number+1);} else {println!("-1");}}