結果

問題 No.239 にゃんぱすー
ユーザー Kaz_nl
提出日時 2017-08-22 21:39:47
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 481 bytes
コンパイル時間 411 ms
コンパイル使用メモリ 55,928 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-15 04:26:44
合計ジャッジ時間 1,523 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
using namespace std;
int a[101];

int main() {
  int n, ans = -1;
  string s;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      cin >> s;
      if (a[j] != -1 && (s == "-" || s == "nyanpass")) a[j] = 1;
      else a[j] = -1;
    }
  }
  for (int i = 1; i <= n; i++) {
    if (a[i] == 1) {
      if (ans == -1) ans = i;
      else {
        ans = -1;
        break;
      }
    }
  }
  cout << ans << endl;
}
0