Submission #169041


Source Code Expand

Copy
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <cmath>
#include <cstdio>
#include <istream>
#include <sstream>
#include <iomanip>
#include <iterator>
#include <climits>
using namespace std;

typedef ostringstream OSS;
typedef istringstream ISS;

typedef vector<int> VI;
typedef vector< VI > VVI;

typedef long long LL;

typedef pair<int, int> PII;
typedef vector<PII> VPII;

#define X first
#define Y second

int main(void) {
	int N;
	cin >> N;
	map<string, int> cnts;
	for (int i = 0; i < N; i++) {
		string name;
		cin >> name;
		cnts[name] = cnts.count(name) ? cnts[name] + 1 : 1;
	}

	cout << (*max_element(cnts.begin(), cnts.end(), [](pair<string, int> a, pair<string, int> b){ return a.second < b.second; })).first << endl;

	return 0;
}

Submission Info

Submission Time
Task B - 投票
User snakazawa
Language C++ (G++ 4.6.4)
Score 0
Code Size 912 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:43:124: warning: lambda expressions only available with -std=c++0x or -std=gnu++0x [enabled by default]
./Main.cpp:43:125: error: no matching function for call to ‘max_element(std::map<std::basic_string<char>, int>::iterator, std::map<std::basic_string<char>, int>::iterator, main()::<lambda(std::pair<std::basic_string<char>, int>, std::pair<std::basic_string<char>, int>)>)’
./Main.cpp:43:125: note: candidates are:
/usr/include/c++/4.6/bits/stl_algo.h:6230:5: note: template<class _FIter> _FIter std::max_element(_FIter, _FIter)
/usr/include/c++/4.6/bits/stl_algo.h:6258:5: note: template<class _FIter, class _Compare> _FIter std::max_element(_FIter, _FIter, _Compare)