結果
| 問題 | No.239 にゃんぱすー |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-01-27 16:30:48 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 6 ms / 2,000 ms |
| コード長 | 767 bytes |
| 記録 | |
| コンパイル時間 | 3,123 ms |
| コンパイル使用メモリ | 341,816 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2026-01-27 16:30:54 |
| 合計ジャッジ時間 | 5,052 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 33 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<vector<string>> g(n, vector<string>(n));
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) { cin >> g[i][j]; }
}
int cnt = 0;
int ans = -1;
for (int j = 0; j < n; j++) {
bool flag = true;
for (int i = 0; i < n; i++) {
if (i == j) continue;
if (g[i][j] != "nyanpass") {
flag = false;
break;
}
}
if (flag) {
cnt++;
ans = j + 1;
}
if (cnt > 1) {
ans = -1;
break;
}
}
if (!cnt)
cout << -1 << endl;
else
cout << ans << endl;
return 0;
}