This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "lang.h"
#include "grader.h"
#define fi first
#define se second
#define pb push_back
using ll = long double;
std::map<ll, ll> lang[60];
int tot[60];
void excerpt(int *E)
{
std::map<ll,ll> fracoes;
for(int i=0;i!=100;++i){
fracoes[E[i]]++;
}
{
double best=0,score=1e9;
for(int i=0;i!=60;++i){
if(!tot[i])continue;
long double penalidade=0;
for(auto&y:lang[i]){
long double x = y.second;
x/=(double)tot[i];
double dif = abs(x-fracoes[y.first]/100.0);
penalidade+=dif*dif;
}
if(penalidade<score){
best=i;
continue;
}
}
int k = language(best);
for(int i=0;i!=100;++i){
tot[k]++;
lang[k][i]++;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |