Submission #168887
Source Code Expand
//include----------------------------------------------------------------------------------------------------------------------
#include <bits/stdc++.h>
//using namespace--------------------------------------------------------------------------------------------------------------
using namespace std;
//define-----------------------------------------------------------------------------------------------------------------------
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define INF 1 << 25
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x) cerr << #x << " = " << (x) << "\n";
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
//typedef----------------------------------------------------------------------------------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned int uint;
typedef unsigned long long ull;
//const------------------------------------------------------------------------------------------------------------------------
const double EPS = 1e-10;
const double PI = acos( -1.0 );
//global-----------------------------------------------------------------------------------------------------------------------
map<string, int> check;
int n;
//function---------------------------------------------------------------------------------------------------------------------
int main() {
scanf( "%d", &n );
string mx;
rep( i, n ) {
string who;
cin >> who;
mx = who;
check[ who ]++;
}
for ( map<string, int>::iterator itpairstri = check.begin(); itpairstri != check.end(); itpairstri++ ) {
if ( check[ mx ] < check[ itpairstri->first ] ) {
mx = itpairstri->first;
}
}
PRINT( mx );
return 0;
}
Submission Info
Submission Time
2014-05-10 21:08:51+0900
Task
B - 投票
User
stone725
Language
C++ (G++ 4.6.4)
Score
100
Code Size
2455 Byte
Status
AC
Exec Time
23 ms
Memory
928 KB
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:46:19: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
Judge Result
Set Name
Sample
All
Score / Max Score
0 / 0
100 / 100
Status
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
23 ms
912 KB
case_02.txt
AC
23 ms
924 KB
case_03.txt
AC
22 ms
916 KB
case_04.txt
AC
23 ms
860 KB
case_05.txt
AC
22 ms
920 KB
case_06.txt
AC
23 ms
880 KB
case_07.txt
AC
21 ms
924 KB
case_08.txt
AC
21 ms
924 KB
case_09.txt
AC
22 ms
872 KB
case_10.txt
AC
21 ms
924 KB
case_11.txt
AC
21 ms
920 KB
case_12.txt
AC
22 ms
928 KB
case_13.txt
AC
22 ms
916 KB
case_14.txt
AC
21 ms
872 KB
case_15.txt
AC
21 ms
920 KB
sample_01.txt
AC
22 ms
800 KB
sample_02.txt
AC
21 ms
872 KB
sample_03.txt
AC
23 ms
920 KB