Submission #169584


Source Code Expand

Copy
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main(){
int n=0;
string tmp;
vector<string> name;
int count=0;
int cnt=0;
string hoge;

cin>>n;

for(int i=0;i<n;++i){
cin>>tmp;
name.push_back(tmp);
}

if(n==1){
cout<<tmp<<endl;
}else{

for(int i=0;i<n;++i){
count=0;
for(int j=i+1;j<n;++j){
if(name[i]==name[j]){
count++;
}
if(cnt<count){
cnt=count;
hoge=name[i];
}
}
}
cout<<hoge<<endl;
}
return 0;
}

Submission Info

Submission Time
Task B - 投票
User compositae
Language C++ (G++ 4.6.4)
Score 100
Code Size 474 Byte
Status
Exec Time 25 ms
Memory 932 KB

Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample_01.txt, sample_02.txt, sample_03.txt
All 100 / 100 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 21 ms 924 KB
case_02.txt 21 ms 676 KB
case_03.txt 21 ms 792 KB
case_04.txt 25 ms 768 KB
case_05.txt 21 ms 928 KB
case_06.txt 21 ms 792 KB
case_07.txt 20 ms 920 KB
case_08.txt 20 ms 924 KB
case_09.txt 20 ms 708 KB
case_10.txt 21 ms 804 KB
case_11.txt 21 ms 932 KB
case_12.txt 21 ms 928 KB
case_13.txt 20 ms 800 KB
case_14.txt 21 ms 800 KB
case_15.txt 21 ms 704 KB
sample_01.txt 22 ms 796 KB
sample_02.txt 20 ms 928 KB
sample_03.txt 23 ms 800 KB