Submission #1331089

#TimeUsernameProblemLanguageResultExecution timeMemory
1331089hectormedranoLanguages (IOI10_languages)C++20
0 / 100
143 ms32224 KiB
#include <bits/stdc++.h>
#include "grader.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
using namespace std;
typedef long long ll;

ll t = 0;
vector<vector<ll>> p(65536, vector<ll>(56, 0));
vector<ll> s(65536, 0);

void train(int E[100]){
    ll L = language(0);
    for(ll i=0;i<100;i++){
        p[E[i]][L]++;
        s[E[i]]++;
    }
}

void solve(int E[100]){
    vector<double> r(56);
    for(ll i=0;i<100;i++){
        for(ll j=0;j<55;j++){
            r[j] += double(p[E[i]][j])/double(s[E[i]]);
        }
    }
    double mx = -1;
    ll ans;
    for(ll i=0;i<56;i++){
        if(mx < r[i]){
            mx = r[i];
            ans = i;
        }
    }
    language(ans);
}

void excerpt(int E[100]){
    if(t<250){train(E); t++;}
    else{solve(E);}
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...