結果
| 問題 |
No.706 多眼生物の調査
|
| コンテスト | |
| ユーザー |
Elk
|
| 提出日時 | 2018-06-29 23:40:09 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 12 ms / 2,000 ms |
| コード長 | 559 bytes |
| コンパイル時間 | 1,544 ms |
| コンパイル使用メモリ | 175,144 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-01 00:22:36 |
| 合計ジャッジ時間 | 2,035 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 5 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:29:13: warning: 'i_cnt' may be used uninitialized [-Wmaybe-uninitialized]
29 | cout << i_cnt << endl;
| ^~~~~
main.cpp:6:36: note: 'i_cnt' was declared here
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;
}
Elk