結果

問題 No.239 にゃんぱすー
ユーザー トミー
提出日時 2024-11-24 17:25:07
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 8 ms / 2,000 ms
コード長 708 bytes
コンパイル時間 2,088 ms
コンパイル使用メモリ 202,420 KB
最終ジャッジ日時 2025-02-25 06:06:33
ジャッジサーバーID
(参考情報)
judge3 / judge5
外部呼び出し有り
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:40:28: warning: ignoring return value of ‘int system(const char*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   40 | int main() { solve();system("pause"); }
      |                      ~~~~~~^~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef int64_t ll;


void solve() {
  ll n;
  cin>>n;
  string s="nyanpass";
  vector<vector<string>> a(n, vector<string>(n));
  for (ll i = 0; i < n; i++) {
    for (ll j = 0; j < n; j++) {
      cin >> a[i][j];
    }
  }
  vector<bool> answer(n, true);
  for (ll i = 0; i < n; i++) {
    for (ll j = 0; j < n; j++) {
      if(i!=j&&a.at(i).at(j)!=s){ 
        answer.at(j)=false;
      }
    }
  }
  ll cnt=0;
  for(ll i=0;i<n;i++){
    if(answer.at(i)) cnt++;
  }
  if(cnt!=1){
    cout<<-1<<endl;
  }else{
    for(ll i=0;i<n;i++){
      if(answer.at(i)) {
        cout<<i+1<<endl;
        break;
      }
    }
  }
} 

int main() { solve();system("pause"); }
0