結果

問題 No.706 多眼生物の調査
ユーザー ohreitetsuohreitetsu
提出日時 2018-06-30 21:49:50
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 11 ms / 2,000 ms
コード長 602 bytes
コンパイル時間 727 ms
コンパイル使用メモリ 77,400 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-13 16:24:03
合計ジャッジ時間 1,349 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 5 ms
4,380 KB
testcase_06 AC 11 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0