結果

問題 No.239 にゃんぱすー
ユーザー alpha_virginis
提出日時 2015-07-10 22:29:49
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 592 bytes
コンパイル時間 1,049 ms
コンパイル使用メモリ 160,452 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-08 01:59:01
合計ジャッジ時間 1,970 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

int main() {

  int N;
  std::string str;
  int num[128] = {};
  int ans;

  std::cin >> N;

  for(int i = 0; i < N; ++i) {
    for(int j = 0; j < N; ++j) {
      std::cin >> str;
      if( str == "nyanpass" ) {
        num[j] += 1;
      }
    }
  }

  ans = -2;
  for(int i = 0; i < N; ++i) {
    if( num[i] == N - 1 ) {
      if( ans == -2 ) {
        ans = i;
      }
      else {
        ans = -1;
      }
    }
  }

  if( ans == -2 || ans == -1 ) {
    std::cout << -1 << std::endl;
  }
  else {
    std::cout << ans+1 << std::endl;
  }
        
  return 0;
}
0