結果

問題 No.239 にゃんぱすー
ユーザー OrisanoOrisano
提出日時 2015-12-09 06:42:22
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 1,499 bytes
コンパイル時間 794 ms
コンパイル使用メモリ 73,840 KB
実行使用メモリ 4,352 KB
最終ジャッジ日時 2023-10-12 22:44:03
合計ジャッジ時間 2,342 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 1 ms
4,352 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,352 KB
testcase_10 AC 2 ms
4,352 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,352 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 3 ms
4,348 KB
testcase_16 AC 3 ms
4,352 KB
testcase_17 AC 3 ms
4,348 KB
testcase_18 AC 3 ms
4,352 KB
testcase_19 AC 4 ms
4,352 KB
testcase_20 AC 4 ms
4,348 KB
testcase_21 AC 4 ms
4,348 KB
testcase_22 AC 4 ms
4,352 KB
testcase_23 AC 5 ms
4,352 KB
testcase_24 AC 6 ms
4,352 KB
testcase_25 AC 5 ms
4,348 KB
testcase_26 AC 6 ms
4,352 KB
testcase_27 AC 1 ms
4,348 KB
testcase_28 AC 1 ms
4,352 KB
testcase_29 AC 2 ms
4,348 KB
testcase_30 AC 2 ms
4,348 KB
testcase_31 AC 2 ms
4,348 KB
testcase_32 AC 3 ms
4,348 KB
testcase_33 AC 4 ms
4,352 KB
testcase_34 AC 5 ms
4,348 KB
testcase_35 AC 5 ms
4,352 KB
testcase_36 AC 6 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>  // {{{
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>

#define GET_MACRO(a, b, c, d, NAME, ...) NAME
#define REP(...) GET_MACRO(__VA_ARGS__, REP4, REP3, REP2)(__VA_ARGS__)
#define REP2(i, a) REP3(i, 0, a)
#define REP3(i, a, b) REP4(i, a, b, 1)
#define REP4(i, a, b, s) for (int i = (a); i < (int)(b); i += (s))
#define REPR(...) GET_MACRO(__VA_ARGS__, REPR4, REPR3, REPR2)(__VA_ARGS__)
#define REPR2(i, a) REPR3(i, 0, a)
#define REPR3(i, a, b) REPR4(i, a, b, 1)
#define REPR4(i, a, b, s) for (int i = (b)-1; i >= (int)(a); i -= (s))
#define ALL(c) (c).begin(), (c).end()

using Int = long long;
// clang-format off
template<typename T,typename U>inline bool chmax(T&x,U a){return x<a&&(x=a,1);}
template<typename T,typename U>inline bool chmin(T&x,U a){return a<x&&(x=a,1);}
inline signed in(){signed x;scanf("%d",&x);return x;}
// clang-format on
// }}}

using namespace std;

template <typename T>
using Mat = vector<vector<T>>;
template <typename T>
Mat<T> buildMat(int R, int C) {
  return move(Mat<T>(R, vector<T>(C)));
}
signed main() {
  int N = in();
  auto A = buildMat<string>(N, N);
  REP(i, N) REP(j, N) cin >> A[i][j];

  vector<int> cand;
  REP(i, N) {
    bool ok = true;
    REP(j, N) {
      if (i == j) continue;
      ok = ok && A[j][i] == "nyanpass";
    }
    if (ok) cand.emplace_back(i + 1);
  }
  if (cand.size() == 1) {
    cout << cand[0] << endl;
  } else {
    puts("-1");
  }

  return 0;
}
0