結果
問題 | No.239 にゃんぱすー |
ユーザー | inu_hir0shi |
提出日時 | 2015-07-10 23:12:27 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 2,333 bytes |
コンパイル時間 | 1,289 ms |
コンパイル使用メモリ | 160,712 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-08 02:09:06 |
合計ジャッジ時間 | 2,186 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,812 KB |
testcase_01 | AC | 2 ms
6,940 KB |
testcase_02 | AC | 1 ms
6,944 KB |
testcase_03 | AC | 1 ms
6,944 KB |
testcase_04 | AC | 1 ms
6,944 KB |
testcase_05 | AC | 1 ms
6,940 KB |
testcase_06 | AC | 1 ms
6,940 KB |
testcase_07 | AC | 1 ms
6,940 KB |
testcase_08 | AC | 1 ms
6,944 KB |
testcase_09 | AC | 1 ms
6,940 KB |
testcase_10 | AC | 1 ms
6,944 KB |
testcase_11 | AC | 2 ms
6,940 KB |
testcase_12 | AC | 1 ms
6,940 KB |
testcase_13 | AC | 2 ms
6,940 KB |
testcase_14 | AC | 1 ms
6,944 KB |
testcase_15 | AC | 2 ms
6,944 KB |
testcase_16 | AC | 2 ms
6,940 KB |
testcase_17 | AC | 2 ms
6,940 KB |
testcase_18 | AC | 1 ms
6,940 KB |
testcase_19 | AC | 2 ms
6,940 KB |
testcase_20 | AC | 2 ms
6,940 KB |
testcase_21 | AC | 1 ms
6,944 KB |
testcase_22 | AC | 3 ms
6,940 KB |
testcase_23 | AC | 2 ms
6,944 KB |
testcase_24 | AC | 2 ms
6,940 KB |
testcase_25 | AC | 2 ms
6,940 KB |
testcase_26 | AC | 3 ms
6,944 KB |
testcase_27 | AC | 1 ms
6,944 KB |
testcase_28 | AC | 1 ms
6,944 KB |
testcase_29 | AC | 1 ms
6,940 KB |
testcase_30 | AC | 1 ms
6,940 KB |
testcase_31 | AC | 2 ms
6,940 KB |
testcase_32 | AC | 2 ms
6,944 KB |
testcase_33 | AC | 2 ms
6,940 KB |
testcase_34 | AC | 2 ms
6,940 KB |
testcase_35 | AC | 2 ms
6,944 KB |
testcase_36 | AC | 3 ms
6,940 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef pair<int,int> PII; typedef long long LL; typedef unsigned long long ULL; template<class T> inline bool amax (T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template<class T> inline bool amin (T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; } template<class T> ostream& operator << (ostream &os, const vector<T> &v) { os << "["; for (typename vector<T>::const_iterator it = v.begin(); it != v.end(); it++) { os << (it != v.begin() ? ", " : "") << *it; } os << "]"; return os; } template<class T> ostream& operator << (ostream &os, const set<T> &s) { os << "{"; for (typename set<T>::const_iterator it = s.begin(); it != s.end(); it++) { os << (it != s.begin() ? ", " : "") << *it; } os << "}"; return os; } template<class K, class V> ostream& operator << (ostream &os, const map<K, V> &m) { os << "{"; for (typename map<K, V>::const_iterator it = m.begin(); it != m.end(); it++) { os << (it != m.begin() ? ", " : "") << it->first << "->" << it->second; } os << "}"; return os; } template<class T, class S> ostream& operator << (ostream &os, const pair<T, S> &p) { os << "(" << p.first << ", " << p.second << ")"; return os; } template <class T> istream& operator >> (istream &is, vector<T> &v) { for (size_t i = 0; i < v.size(); i++) is >> v[i]; return is; } template <class T, class S> inline T lexical_cast (const S &s) { T t; stringstream ss; ss << s; ss >> t; return t; } //> v < ^ (clock wise) int dx[] = {1,0,-1,0}; int dy[] = {0,1,0,-1}; const int INFI = 1<<28; const long long int INFL = 1LL<<60; const float INFF = 1e+100; const double INFD = 1e+300; const double EPS = 1e-8; const long long int MOD = 1000000007; void solve (); int main () { cout.setf(ios::fixed); cout.precision(10); ios_base::sync_with_stdio(false); solve(); return 0; } void solve () { int N; cin >> N; vector<bool> a(N, true); for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { string s; cin >> s; if (s == "-") continue; a[j] = a[j] & (s == "nyanpass"); } } int cnt = 0; for (int i = 0; i < N; i++) if (a[i]) cnt++; int ans = -1; for (int i = 0; i < N; i++) { if (a[i]) ans = i+1; } if (cnt != 1) ans = -1; cout << ans << endl; }