結果

問題 No.239 にゃんぱすー
ユーザー test
提出日時 2020-09-07 22:16:53
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 47 ms / 2,000 ms
コード長 533 bytes
コンパイル時間 2,037 ms
コンパイル使用メモリ 198,276 KB
最終ジャッジ日時 2025-01-14 08:17:07
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, ss, ee) for (int i = ss; i < ee; ++i)
using namespace std;

int solve() {
  int N;
  string s;
  set<int> st;
  cin >> N;
  vector<int> v(N);
  rep(i, 0, N) {
    rep(j, 0, N) {
      cin >> s;
      if (s == "nyanpass") v[j]++;
    }
  }
  rep(i, 0, N) if (v[i] == N - 1) st.emplace(i + 1);
  int ans = -1;
  if (st.size() == 1) {
    auto it = st.begin();
    ans = *it;
  }
  return ans;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << solve() << endl;
  getchar();
}
0