Submission #1016744

#TimeUsernameProblemLanguageResultExecution timeMemory
1016744huutuanLanguages (IOI10_languages)C++14
100 / 100
651 ms80208 KiB
#include <stdlib.h> #include <stdio.h> #include "grader.h" #include "lang.h" #include <bits/stdc++.h> using namespace std; const int mod=100003; int cnt[10][mod][60]; int ss[10][mod]; double get(int h, int i, int j){ int sum=ss[h][i]; if (!sum) return 0; return (double)cnt[h][i][j]/(double)sum; } int cc[56], tc; double sum[56]; int a[10][100]; void excerpt(int *E) { for (int h=0; h<4; ++h) for (int i=h; i<100; ++i){ if (h==0) a[h][i]=E[i]; else a[h][i]=(1ll*a[h-1][i-1]*65536+E[i])%mod; } pair<double, int> ans={0, 0}; for (int j=0; j<56; ++j){ sum[j]=0; for (int h=0; h<4; ++h) for (int i=h; i<100; ++i){ sum[j]+=get(h, a[h][i], j); } ans=max(ans, {sum[j], j}); } int real=language(ans.second); for (int h=0; h<4; ++h) for (int i=h; i<100; ++i){ ++cnt[h][a[h][i]][real]; ++ss[h][a[h][i]]; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...