結果
問題 | No.706 多眼生物の調査 |
ユーザー | Elk |
提出日時 | 2018-06-29 23:40:09 |
言語 | C++14 (gcc 13.2.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 11 ms / 2,000 ms |
コード長 | 559 bytes |
コンパイル時間 | 1,531 ms |
コンパイル使用メモリ | 172,368 KB |
実行使用メモリ | 4,380 KB |
最終ジャッジ日時 | 2023-09-13 15:46:35 |
合計ジャッジ時間 | 2,175 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,376 KB |
testcase_01 | AC | 2 ms
4,380 KB |
testcase_02 | AC | 1 ms
4,376 KB |
testcase_03 | AC | 1 ms
4,380 KB |
testcase_04 | AC | 2 ms
4,380 KB |
testcase_05 | AC | 5 ms
4,376 KB |
testcase_06 | AC | 11 ms
4,380 KB |
testcase_07 | AC | 1 ms
4,376 KB |
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内: main.cpp:29:13: 警告: ‘i_cnt’ may be used uninitialized [-Wmaybe-uninitialized] 29 | cout << i_cnt << endl; | ^~~~~ main.cpp:6:36: 備考: ‘i_cnt’ はここで定義されています 6 | int cnt = 0, N, i, j, max = 0, i_cnt; | ^~~~~
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ map <int, int> mp; int cnt = 0, N, i, j, max = 0, i_cnt; string str; cin >> N; for(i = 0; i < N; i++){ cin >> str; for(j = 0; j < str.size(); j++){ if(str[j] == '^') cnt++; } mp[cnt]++; cnt = 0; } for(auto itr = mp.begin(); itr != mp.end(); itr++){ if(max <= itr->second){ max = itr->second; i_cnt = itr->first; } } cout << i_cnt << endl; return 0; }