結果
| 問題 | 
                            No.239 にゃんぱすー
                             | 
                    
| コンテスト | |
| ユーザー | 
                             r2en_
                         | 
                    
| 提出日時 | 2017-07-11 11:59:59 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 6 ms / 2,000 ms | 
| コード長 | 568 bytes | 
| コンパイル時間 | 834 ms | 
| コンパイル使用メモリ | 73,756 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-10-07 14:44:11 | 
| 合計ジャッジ時間 | 1,885 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 33 | 
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
int main(){
    string s;
    int n; cin >> n;
    vector<int>a(100);
    rep(i,n){
        rep(j,n){
            cin >> s;
            if(s=="nyanpass"){ a[j+1]++; }
        }
    }
    int res = 0;
    int cnt = 0;
    //rep(i,100){ cout << a[i] << endl;}
    rep(i,100){ if(a[i]==n-1){ cnt++; res = i; } }
    if(cnt>1){ cout << "-1" << endl; }
    else if(res!=0){ cout << res << endl; }
    else{ cout << "-1" << endl; }
    return 0;
}
            
            
            
        
            
r2en_