結果
問題 | No.239 にゃんぱすー |
ユーザー |
|
提出日時 | 2017-10-08 19:15:22 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 7 ms / 2,000 ms |
コード長 | 498 bytes |
コンパイル時間 | 1,409 ms |
コンパイル使用メモリ | 158,896 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-17 05:47:35 |
合計ジャッジ時間 | 3,006 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 33 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main(void) {int n;cin >> n;string a[110][110];for (int i = 0; i < n; i++) {for (int j = 0; j < n; j++) {cin >> a[i][j];}}int cnt = 0, ans = -1;for (int i = 0; i < n; i++) {bool flag = true;for (int j = 0; j < n; j++) {if (i == j) continue;flag &= (a[j][i] == "nyanpass");}if (flag) ans = i + 1;cnt += flag;}cout << (cnt == 1 ? ans : -1) << endl;return 0;}