結果
| 問題 |
No.239 にゃんぱすー
|
| ユーザー |
tokizo
|
| 提出日時 | 2018-01-13 11:08:30 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 885 bytes |
| コンパイル時間 | 897 ms |
| コンパイル使用メモリ | 101,232 KB |
| 最終ジャッジ日時 | 2025-01-05 07:29:55 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 33 |
ソースコード
#include <iostream>
#include <math.h>
#include <algorithm>
#include <functional>
#include <vector>
#include <typeinfo>
#include <climits>
#include <ctype.h>
#include <string>
#include <stdio.h>
using namespace std;
#define INIT cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i, a, n) for (int i = a; i < n; i++)
#define REP(i, n) for(int i = 0; i < n; i++)
int main()
{
INIT;
int n;
cin >> n;
string S[n][n];
REP(i, n){
REP(j, n){
cin >> S[i][j];
}
}
int c1, c2 = 0, idx = -1;
REP(i, n){
c1 = 0;
REP(j, n){
if(i != j){
if(S[j][i] == "nyanpass") c1++;
}
}
if(c1 == n - 1){
c2++;
idx = i + 1;
}
if(c2 > 1){
idx = -1;
break;
}
}
cout << idx << endl;
return 0;
}
tokizo