結果
問題 | No.239 にゃんぱすー |
ユーザー | koyumeishi |
提出日時 | 2015-07-10 22:30:13 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 7 ms / 2,000 ms |
コード長 | 691 bytes |
コンパイル時間 | 787 ms |
コンパイル使用メモリ | 78,788 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-08 01:59:18 |
合計ジャッジ時間 | 1,857 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 33 |
ソースコード
#include <iostream> #include <vector> #include <cstdio> #include <sstream> #include <map> #include <string> #include <algorithm> #include <queue> #include <cmath> #include <set> using namespace std; const string x = "nyanpass"; int main(){ int n; cin >> n; vector<vector<string>> s(n, vector<string>(n)); for(int i=0; i<n; i++){ for(int j=0; j<n; j++){ cin >> s[i][j]; } } int cnt = 0; int num = -1; for(int i=0; i<n; i++){ bool ok = true; for(int j=0; j<n; j++){ if(i==j) continue; if(s[j][i] != x){ ok = false; break; } } if(ok){ num = i; cnt++; } } if(cnt == 1){ cout << num+1 << endl; }else{ cout << -1 << endl; } return 0; }