Submission #792799


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
#define ITR(i,c) for(auto i=begin(c);i!=end(c);i++)
#define FOR(i,a,n) for(int i=a;i<(int)(n);i++)
#define FORR(x,arr) for(auto& x:arr)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) begin(c),end(c)
#define PB push_back
#define MP make_pair
const int DX[4]={0,1,0,-1}, DY[4]={-1,0,1,0};
const int INF = 1e9;

int main(int argc, char const *argv[]) {
    int n;
    cin >> n;
    map<string,int> m;
    REP(i,n) {
        string s;
        cin >> s;
        if(m.find(s)==m.end()) {
            m.insert(MP(s,1));
        }
        else {
            m[s]++;
        }
    }
    string ans;
    int M=0;
    ITR(i,m) {
        if(M<(i->second)) {
            ans = i->first;
            M = i->second;
        }
    }
    cout << ans << endl;
    return 0;
}

Submission Info

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

Compile Error

./Main.cpp: In function ‘int main(int, const char**)’:
./Main.cpp:31:5: error: ‘i’ does not name a type
./Main.cpp:31:5: error: expected ‘;’ before ‘i’
./Main.cpp:31:5: error: name lookup of ‘i’ changed for ISO ‘for’ scoping [-fpermissive]
./Main.cpp:31:5: note: (if you use ‘-fpermissive’ G++ will accept your code)
./Main.cpp:31:5: error: ‘end’ was not declared in this scope
./Main.cpp:32:16: error: base operand of ‘->’ is not a pointer
./Main.cpp:33:20: error: base operand of ‘->’ is not a pointer
./Main.cpp:34:18: error: base operand of ‘->’ is not a pointer