結果

問題 No.239 にゃんぱすー
ユーザー 👑 p-adic
提出日時 2022-08-08 21:51:28
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
AC  
実行時間 75 ms / 2,000 ms
コード長 829 bytes
コンパイル時間 920 ms
コンパイル使用メモリ 73,212 KB
最終ジャッジ日時 2025-01-30 19:29:52
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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";
  vector<char> b( N + 1 , 1 );
  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 == 1 ){

  	if( i != j ){

  	  if( a != n ){

  	    bj = 0;
  	    num--;

  	  }

  	}

      }

    }
    
  }

  if( num == 1 ){

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

      if( b[j] == 1 ){

  	cout << j << endl;
  	return 0;

      }

    }

  } else {

    cout << -1 << endl;

  }
  
  return 0;

}
0