結果
| 問題 |
No.239 にゃんぱすー
|
| ユーザー |
kekenx
|
| 提出日時 | 2020-03-05 12:05:17 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 6 ms / 2,000 ms |
| コード長 | 619 bytes |
| コンパイル時間 | 1,587 ms |
| コンパイル使用メモリ | 171,540 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-14 00:55:29 |
| 合計ジャッジ時間 | 3,448 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 33 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n;
cin >> n;
vector< vector<string> > a(n, vector<string>(n));
for (int i = 0; i < n; ++i) {
for (int j = 0; j < n; ++j) {
cin >> a[i][j];
}
}
string t = "nyanpass";
int ans = -1;
bool is_valid = true;
for (int i = 0; i < n; ++i) {
int cnt = 0;
for (int j = 0; j < n; ++j) {
if (a[j][i] == t) cnt++;
}
if (ans != -1 && cnt == n - 1) is_valid = false;
if (cnt == n - 1) ans = i + 1;
}
if (ans != -1 && is_valid) cout << ans << '\n';
else puts("-1");
return 0;
}
kekenx