結果
問題 | No.239 にゃんぱすー |
ユーザー |
|
提出日時 | 2020-04-29 00:42:15 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 865 bytes |
コンパイル時間 | 26,535 ms |
コンパイル使用メモリ | 401,252 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-26 07:08:49 |
合計ジャッジ時間 | 14,769 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 33 |
ソースコード
use std::io::*; fn main() { let mut s: String = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let mut itr = s.trim().split_whitespace(); let n: usize = itr.next().unwrap().parse().unwrap(); let grid: Vec<Vec<&str>> = (0..n) .map(|_| (0..n).map(|_| itr.next().unwrap()).collect()) .collect(); let mut ans = 0; for j in 0..n { let mut ok = true; for i in 0..n { if i == j { continue; } if grid[i][j] != "nyanpass" { ok = false; } } if ok { if ans != 0 { println!("-1",); return; } else { ans = j + 1; } } } if ans == 0 { println!("-1",) } else { println!("{}", ans) } }