結果

問題 No.239 にゃんぱすー
ユーザー moti
提出日時 2015-07-18 03:20:44
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 774 bytes
コンパイル時間 657 ms
コンパイル使用メモリ 85,028 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-08 10:06:06
合計ジャッジ時間 1,734 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <complex>
#include <queue>
#include <set>
#include <map>

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)

typedef long long ll;

int main() {

  int N; cin >> N;
  vector<vector<string>> A(N, vector<string>(N));
  rep(i, N) {
    rep(j, N) {
      cin >> A[i][j];
    }
  }

  int ans = 0;

  rep(j, N) {
    bool ok = true;
    rep(i, N) {
      if(i == j) { continue; }
      if(A[i][j] != "nyanpass") { ok = false; break; }
    }
    if(ok) {
      if(ans == 0) {
        ans = j+1;
      }
      else {
        ans = -1;
      }
    }
  }

  if(ans <= 0) {
    cout << -1 << endl;
  }
  else {
    cout << ans << endl;
  }

  return 0;
}
0