結果
問題 | No.239 にゃんぱすー |
ユーザー |
|
提出日時 | 2020-04-04 22:24:58 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 6 ms / 2,000 ms |
コード長 | 902 bytes |
コンパイル時間 | 1,239 ms |
コンパイル使用メモリ | 77,264 KB |
最終ジャッジ日時 | 2025-01-09 14:08:31 |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 33 |
ソースコード
#include <iostream>#include <string>#include <vector>template <class T>std::vector<T> vec(int len, T elem) { return std::vector<T>(len, elem); }const std::string nyan = "nyanpass";void solve() {int n;std::cin >> n;auto xss = vec(n, vec(n, std::string()));for (auto& xs : xss) {for (auto& x : xs) std::cin >> x;}int ans = -1;for (int j = 0; j < n; ++j) {bool ok = true;for (int i = 0; i < n; ++i) {if (i != j && xss[i][j] != nyan) ok = false;}if (ok) {if (ans == -1) {ans = j;} else {std::cout << -1 << std::endl;return;}}}std::cout << (ans == -1 ? -1 : ans + 1) << std::endl;}int main() {std::cin.tie(nullptr);std::ios::sync_with_stdio(false);solve();return 0;}