結果

問題 No.239 にゃんぱすー
ユーザー 👑 p-adic
提出日時 2022-08-08 22:01:23
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
AC  
実行時間 17 ms / 2,000 ms
コード長 808 bytes
コンパイル時間 805 ms
コンパイル使用メモリ 72,416 KB
最終ジャッジ日時 2025-01-30 19:30:05
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <list>
#include <vector>
#include <string>
#include <stdio.h>
#include <stdint.h>
using namespace std;

using uint = unsigned int;
using ll = long long;

#define CIN( LL , A ) LL A; cin >> A 
#define GETLINE( A ) string A; getline( cin , A ) 

int main()
{

  CIN( ll , N );
  string a;
  const string n = "nyanpass";
  char b[101] = {};
  ll num = N;

  for( ll i = 1 ; i <= N ; i++ ){

    for( ll j = 1 ; j <= N ; j++ ){
    
      cin >> a;
      char& bj = b[j];

      if( ! bj ){

	if( a != n ){

	  if( i != j ){

  	    bj = 1;
  	    num--;

  	  }

  	}

      }

    }
    
  }

  if( num == 1 ){

    for( ll j = 1 ; j <= N ; j++ ){

      if( ! b[j] ){

  	cout << j << endl;
  	return 0;

      }

    }

  } else {

    cout << -1 << endl;

  }
  
  return 0;

}
0