Submission #169073


Source Code Expand

Copy
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <stack>
#include <queue>
#include <cctype>
#include <complex>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <cassert>
#include <iomanip>

using namespace std;

#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
typedef complex<int> P;
typedef pair<int,int> pii;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
template <class F, class T> void convert(const F &f, T &t){	stringstream ss; ss << f; ss >> t;}


bool solve(){
	int n;
	cin>> n;
	
	vector<pair<string, int> > vpi;
	for(int i=0;i<n;i++){
		string str;
		cin>> str;
		bool f = false;
		for(int j=0;j<vpi.size();j++){
			if(vpi[j].first == str){
				vpi[j].second++;
				f = true;
			}
		}
		if(!f){
			vpi.pb(make_pair<string, int>(str, 1));
		}
	}
	
	int cnt = 0;
	string ans = "nyaa~";
	for(int i=0;i<vpi.size();i++){
		if(cnt < vpi[i].second){
			cnt = vpi[i].second;
			ans = vpi[i].first;
		}
	}
	cout<< ans<< endl;
	return true;
}

int main(){
	cout.setf(ios::fixed); cout.precision(10);
	solve();
	return 0;
}

 

Submission Info

Submission Time
Task B - 投票
User yokabb
Language C++ (G++ 4.6.4)
Score 100
Code Size 1284 Byte
Status AC
Exec Time 48 ms
Memory 1088 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 3
AC × 18
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All sample_01.txt, sample_02.txt, sample_03.txt, case_01.txt, case_02.txt, case_03.txt, case_04.txt, case_05.txt, case_06.txt, case_07.txt, case_08.txt, case_09.txt, case_10.txt, case_11.txt, case_12.txt, case_13.txt, case_14.txt, case_15.txt
Case Name Status Exec Time Memory
case_01.txt AC 48 ms 924 KB
case_02.txt AC 26 ms 1036 KB
case_03.txt AC 25 ms 924 KB
case_04.txt AC 25 ms 928 KB
case_05.txt AC 28 ms 1044 KB
case_06.txt AC 30 ms 992 KB
case_07.txt AC 28 ms 924 KB
case_08.txt AC 28 ms 928 KB
case_09.txt AC 24 ms 924 KB
case_10.txt AC 27 ms 928 KB
case_11.txt AC 26 ms 1044 KB
case_12.txt AC 27 ms 928 KB
case_13.txt AC 26 ms 984 KB
case_14.txt AC 27 ms 924 KB
case_15.txt AC 29 ms 1088 KB
sample_01.txt AC 24 ms 1036 KB
sample_02.txt AC 27 ms 1036 KB
sample_03.txt AC 27 ms 1028 KB