結果

問題 No.239 にゃんぱすー
ユーザー トミー
提出日時 2024-11-24 17:16:45
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 635 bytes
コンパイル時間 2,257 ms
コンパイル使用メモリ 202,576 KB
最終ジャッジ日時 2025-02-25 06:06:23
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 2
other AC * 16 WA * 17
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:35:28: warning: ignoring return value of ‘int system(const char*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   35 | 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);
  ll cnt=0;
  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(i)=false;
        cnt++;
      }
    }
  }
  if(cnt!=1){
    cout<<-1<<endl;
  }else{
    for(ll i=0;i<n;i++){
      if(answer.at(i)) cout<<i+1<<endl;
    }
  }
} 

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