Submission #27834647


Source Code Expand

#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <iomanip>
#include <cassert>
#include <bit>
#include <cstdint>
#include <queue>
#include <sstream>
using namespace std;
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define rerep(i,a,n) for(ll i=n;i>=a;i--)
#define elif else if
#define all(s) s.begin(),s.end()
typedef long long ll;

const ll MOD = 998244353;
const ll mod = 1000000007;
const double pi=3.14159265358979;
const ll INF = 1e18+1;
ll sum(ll n){
    if(n == 1)return 1;
    return n + sum(n-1);
}
ll factm[60];
ll factrial(ll n){
    if(n==0)return 1;
    if(factm[n] != -1)return factm[n];
    factm[n] = n*factrial(n-1);
    return factm[n];
}
ll combination(ll n,ll k){
    return factrial(n)/(factrial(n-k)*factrial(k));
}
vector<ll> num(ll k,ll b){
    ll sum = 0;
    ll cnt = b-1;
    if(b==1){
        vector<ll> res = {k,0};
        return res;
    }
    while(1){
        cout << " " << cnt << endl;
        ll comb = combination(cnt,b-1);
        if(sum+comb == k){
            cnt++;
            break;
        }
        if(sum+comb > k)break;
        sum+=comb;
        cnt++;
    }
    cout << cnt << endl;
    vector<ll> res = {cnt};
    vector<ll> rec = num(k-sum,b-1);
    res.insert(res.end(),rec.begin(),rec.end());
    return res;
}
bool comp(const pair<ll,ll> &a,const pair<ll,ll> &b){return a.first<b.first;}
void sort2vectors(vector<ll> &av,vector<ll> &bv){
    ll n = av.size();
        vector<pair<ll,ll>> p(n);
        vector<ll> av2(n), bv2(n);
        rep(i,0,n)
                p[i] = make_pair(av[i], bv[i]);
        sort(p.begin(), p.end(), comp);
        for (ll i = 0; i < n; i++) {
                av2[i] = p[i].first;
                bv2[i] = p[i].second;
        }
        av = av2;
        bv = bv2;
}
template<typename KeyType, typename ValueType>
pair<KeyType,ValueType> get_max(const map<KeyType,ValueType>& x){
    using pairtype=pair<KeyType,ValueType>;
    return *max_element(x.begin(),x.end(),[](const pairtype & p1,const pairtype & p2){
        return p1.second < p2.second;
    });
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    map<string,ll> s;
    ll n;
    cin >> n;
    rep(i,0,n){
        string x;
        cin >> x;
        if(s.find(x) == s.end()){
            s.insert({x,1});
        }
        else s[x]++;
    }
    string ans;
    ll M = 0;
    for(auto i = s.cbegin();i != s.cend();++i){
        if(i->second > M){
            M = i->second;
            ans = i->first;
        }
    }
    cout << ans << endl;
    return 0;
}

Submission Info

Submission Time
Task B - Election
User h3kun
Language C++ (GCC 9.2.1)
Score 200
Code Size 2684 Byte
Status AC
Exec Time 6 ms
Memory 3608 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 14
Set Name Test Cases
Sample sample_00.txt, sample_01.txt, sample_02.txt
All case_00.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, sample_00.txt, sample_01.txt, sample_02.txt
Case Name Status Exec Time Memory
case_00.txt AC 6 ms 3504 KiB
case_01.txt AC 2 ms 3436 KiB
case_02.txt AC 3 ms 3556 KiB
case_03.txt AC 1 ms 3596 KiB
case_04.txt AC 2 ms 3444 KiB
case_05.txt AC 2 ms 3604 KiB
case_06.txt AC 1 ms 3496 KiB
case_07.txt AC 2 ms 3488 KiB
case_08.txt AC 2 ms 3608 KiB
case_09.txt AC 2 ms 3504 KiB
case_10.txt AC 2 ms 3484 KiB
sample_00.txt AC 2 ms 3600 KiB
sample_01.txt AC 3 ms 3440 KiB
sample_02.txt AC 6 ms 3480 KiB