結果
問題 | No.706 多眼生物の調査 |
ユーザー |
|
提出日時 | 2018-06-30 21:49:50 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 13 ms / 2,000 ms |
コード長 | 602 bytes |
コンパイル時間 | 791 ms |
コンパイル使用メモリ | 77,380 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-01 01:00:55 |
合計ジャッジ時間 | 1,277 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 5 |
ソースコード
#include <iostream>#include <map>#include <string>using namespace std;int main(int argc, char* argv[]){int N,i;cin>>N;string S;map<string,int> myMap;map<string,int>::iterator mit;int maxVal=0;string maxS;for (i=0;i<N;i++){cin>>S;mit=myMap.find(S);if (mit==myMap.end()){myMap[S]=1;if (maxVal<1){maxVal=1;}}else{(*mit).second++;if (maxVal<(*mit).second){maxVal=(*mit).second;}}}for (mit=myMap.begin();mit!=myMap.end();mit++){if ((*mit).second==maxVal){maxS=(*mit).first;}}cout<<maxS.length()-2<<endl;return 0;}