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 "grader.h"
#include "lang.h"
const int MAX_SYMBOLS = 65545;
const int MAX_LANGS=56;
using namespace std;
double freq[MAX_LANGS][MAX_SYMBOLS];
int seen[MAX_LANGS];
void excerpt(int E[])
{
double f1[MAX_SYMBOLS];
for(int i=0;i<MAX_SYMBOLS;i++)f1[i]=0;
for(int i=0;i<100;i++)
{
f1[E[i]-1]+=1;
}
for(int i=0;i<MAX_SYMBOLS;i++)
{
f1[i]/=100.0;
}
int guess=0;
double mindiff=2e9;
for(int i=0;i<MAX_LANGS;i++)
{
if(seen[i]==0)continue;
double err=0;
for(int j=0;j<MAX_SYMBOLS;j++)
{
err+=(freq[i][j]-f1[j])*(freq[i][j]-f1[j]);
}
if(err<mindiff)
{
guess=i;
mindiff=err;
}
}
int l=language(guess);
int s=seen[l];
double c1=1.0*s/(s+1);
double c2=1.0/(s+1);
for(int i=0;i<MAX_SYMBOLS;i++)
{
freq[l][i]=freq[l][i]*c1+f1[i]*c2;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |