結果
| 問題 |
No.239 にゃんぱすー
|
| ユーザー |
chiyoda
|
| 提出日時 | 2016-06-26 22:15:36 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 7 ms / 2,000 ms |
| コード長 | 554 bytes |
| コンパイル時間 | 452 ms |
| コンパイル使用メモリ | 56,056 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-11 23:26:38 |
| 合計ジャッジ時間 | 2,260 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 33 |
ソースコード
#include <iostream>
#include <string>
using namespace std;
int main() {
int n;
cin >> n;
string a[100][100];
for (int i = 0; i < n; ++i) for (int j = 0; j < n; ++j) cin >> a[i][j];
int res = -1;
for (int i = 0; i < n; ++i) {
bool flg = true;
for (int j = 0; j < n && flg; ++j) {
if (a[j][i] != "nyanpass" && i != j) {
flg = false;
}
}
if (flg) {
if (res == -1) {
res = i + 1;
} else {
cout << -1 << endl;
return 0;
}
}
}
cout << res << endl;
return 0;
}
chiyoda