結果
問題 |
No.239 にゃんぱすー
|
ユーザー |
![]() |
提出日時 | 2017-11-19 20:32:44 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 855 bytes |
コンパイル時間 | 2,102 ms |
コンパイル使用メモリ | 161,240 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-26 00:36:40 |
合計ジャッジ時間 | 2,467 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 WA * 1 |
other | AC * 25 WA * 8 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:27:25: warning: ‘key2’ may be used uninitialized in this function [-Wmaybe-uninitialized] 27 | cout << key2 << endl; | ^~~~ main.cpp:23:25: warning: ‘key1’ may be used uninitialized in this function [-Wmaybe-uninitialized] 23 | cout << key1 << endl; | ^~~~
ソースコード
#include<bits/stdc++.h> using namespace std; int main(){ int N; cin >> N; string nyan[N][N]; int cnt = 0; vector<int> v; int key1, key2; for(int i=0; i<N; i++){ for(int j=0; j<N; j++){ cin >> nyan[i][j]; if(nyan[i][j] == "nyanpass"){ cnt++; if(i == 0) key1 = j+1; if(i == 1) key2 = j+1; v.push_back(j); } } } if(cnt == N || cnt == N-1){ for(int i = 0; i<N; i++){ if(v[i]+1 == key1){ cout << key1 << endl; break; } if(v[i]+1 == key2){ cout << key2 << endl; break; } cout << -1 << endl; break; } }else{ cout << -1 << endl; } return 0; }