結果
問題 | No.239 にゃんぱすー |
ユーザー |
![]() |
提出日時 | 2018-10-03 15:21:54 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 7 ms / 2,000 ms |
コード長 | 1,190 bytes |
コンパイル時間 | 1,020 ms |
コンパイル使用メモリ | 101,216 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-12 10:21:45 |
合計ジャッジ時間 | 2,936 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 33 |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:79:25: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized] 79 | cout << ans << endl; | ^~~ main.cpp:66:13: note: 'ans' was declared here 66 | int ans; | ^~~
ソースコード
#include <stdio.h>#include <algorithm>#include <iostream>#include <string>#include <vector>#include <functional>#include <map>#include <iomanip>#include <math.h>#include <stack>#include <queue>#include <bitset>#include <cstdlib>#include <tuple>#include <cctype>#include <ctype.h>#include <set>#include <sstream>using namespace std;int main() {int i, j, k;vector<bool>flag(110, false);vector<vector<string>>list(111, vector<string>(111));int n;cin >> n;for (i = 0; i < n; i++) {for (j = 0; j < n; j++) {string s;cin >> s;list[i][j] = s;}}for (i = 0; i < n; i++) {for (j = 0; j < n; j++) {if (list[i][j] == "nyanpass") {bool fflag = false;for (k = 0; k < n; k++) {if (k == j) continue;if (list[k][j] != "nyanpass") {fflag = true;//flag[j] = true;break;}}if (fflag == false) {flag[j] = true;}}}}int cnt = 0;int ans;for (i = 0; i < n; i++) {if (flag[i] == true) {cnt++;ans = i + 1;}}if (cnt >= 2 || cnt == 0 ) {cout << -1 << endl;}else {cout << ans << endl;}getchar();getchar();return 0;}