結果
| 問題 |
No.706 多眼生物の調査
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-01-02 13:46:37 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 426 bytes |
| コンパイル時間 | 2,022 ms |
| コンパイル使用メモリ | 173,356 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-19 04:57:34 |
| 合計ジャッジ時間 | 2,389 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 5 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:27:17: warning: 'mode' may be used uninitialized [-Wmaybe-uninitialized]
27 | cout << mode << endl;
| ^~~~
main.cpp:20:22: note: 'mode' was declared here
20 | int num = 0, mode;
| ^~~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
map<int, int> mp;
int n;
cin >> n;
while(n--) {
string s;
cin >> s;
int cnt = 0;
for(int i = 0; i < s.size(); i++) {
if(s[i] == '^') cnt++;
}
mp[cnt]++;
}
int num = 0, mode;
for(auto i : mp) {
if(i.second >= num) {
num = i.second;
mode = i.first;
}
}
cout << mode << endl;
return 0;
}