結果
| 問題 | 
                            No.239 にゃんぱすー
                             | 
                    
| コンテスト | |
| ユーザー | 
                             hayaD
                         | 
                    
| 提出日時 | 2016-09-03 07:31:54 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 7 ms / 2,000 ms | 
| コード長 | 797 bytes | 
| コンパイル時間 | 715 ms | 
| コンパイル使用メモリ | 81,648 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-15 18:30:10 | 
| 合計ジャッジ時間 | 1,980 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 33 | 
ソースコード
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <cmath>
using namespace std;
#define FOR(i,s,e) for (int i = int(s); i != int(e); i++)
#define FORIT(i,c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define ISEQ(c) (c).begin(), (c).end()
int main(){
	int N;
	cin >> N;
	string s[N][N];
	FOR(i,0,N){
		FOR(j,0,N){
			cin >> s[i][j];
		}
	}
	bool isNyanpass[N];
	FOR(j,0,N){
		isNyanpass[j] = true;
		FOR(i,0,N){
			if(i != j && s[i][j] != "nyanpass"){
				isNyanpass[j] = false;
			}
		}
	}
	int ans = -1;
	FOR(i,0,N){
		if (isNyanpass[i]){
			if(ans == -1) ans = i+1;
			else{
				ans = -1;
				break;
			}
		}
	}
	cout << ans << endl;
	return 0;
}
            
            
            
        
            
hayaD