結果

問題 No.239 にゃんぱすー
ユーザー SSRS
提出日時 2020-07-18 21:20:51
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 8 ms / 2,000 ms
コード長 572 bytes
コンパイル時間 1,909 ms
コンパイル使用メモリ 173,512 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-14 07:50:02
合計ジャッジ時間 3,685 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
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];
    }
  }
  vector<int> ans;
  for (int i = 0; i < N; i++){
    bool ok = true;
    for (int j = 0; j < N; j++){
      if (j != i){
        if (A[j][i] != "nyanpass"){
          ok = false;
        }
      }
    }
    if (ok){
      ans.push_back(i);
    }
  }
  if (ans.size() == 1){
    cout << ans[0] + 1 << endl;
  } else {
    cout << -1 << endl;
  }
}
0