結果

問題 No.239 にゃんぱすー
ユーザー 👑 p-adic
提出日時 2022-08-08 21:21:31
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
AC  
実行時間 42 ms / 2,000 ms
コード長 1,073 bytes
コンパイル時間 790 ms
コンパイル使用メモリ 77,712 KB
最終ジャッジ日時 2025-01-30 19:29:12
ジャッジサーバーID
(参考情報)
judge2 / 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;
  vector<list<string> > A( N + 1 , list<string>() );

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

    for( ll j = 1 ; j <= N ; j++ ){
    
      cin >> a;
      A[j].push_back( a );

    }
    
  }

  const string h = "-";
  const string n = "nyanpass";

  ll answer = 0;
  
  for( ll j = 1 ; j <= N && answer != -1 ; j++ ){

    const list<string>& Aj = A[j];
    bool poi = true;
    
    for( auto itr = Aj.begin() , end = Aj.end() ; itr != end && poi ; itr++ ){

      const string& Aij = *itr;
      
      if( Aij != h && Aij != n ){

	poi = false;

      }

    }

    if( poi ){

      if( answer == 0 ){

	answer = j;

      } else {

	answer = -1;

      }

    }

  }

  if( answer == 0 ){

    answer = -1;

  }

  cout << answer << endl;
  return 0;

}
0