結果
問題 | No.706 多眼生物の調査 |
ユーザー | potoooooooo |
提出日時 | 2018-06-29 22:37:49 |
言語 | C++14 (gcc 13.2.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 11 ms / 2,000 ms |
コード長 | 377 bytes |
コンパイル時間 | 1,508 ms |
コンパイル使用メモリ | 170,832 KB |
実行使用メモリ | 4,380 KB |
最終ジャッジ日時 | 2023-09-13 15:26:00 |
合計ジャッジ時間 | 2,092 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,376 KB |
testcase_01 | AC | 2 ms
4,376 KB |
testcase_02 | AC | 2 ms
4,376 KB |
testcase_03 | AC | 2 ms
4,380 KB |
testcase_04 | AC | 2 ms
4,376 KB |
testcase_05 | AC | 5 ms
4,376 KB |
testcase_06 | AC | 11 ms
4,380 KB |
testcase_07 | AC | 2 ms
4,376 KB |
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内: main.cpp:18:17: 警告: ‘ans’ may be used uninitialized [-Wmaybe-uninitialized] 18 | cout << ans - 2 << endl; | ^ main.cpp:11:19: 備考: ‘ans’ はここで定義されています 11 | int ma = 0; int ans; | ^~~
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; map<int, int> m; for (int i = 0; i < n; i++) { string s; cin >> s; m[s.size()]++; } int ma = 0; int ans; for (auto it = m.begin(); it != m.end(); it++) { if (it->second >= ma) { ans = it -> first; ma = it->second; } } cout << ans - 2 << endl; return 0; }