Submission #1012349

#TimeUsernameProblemLanguageResultExecution timeMemory
1012349huutuanLanguages (IOI10_languages)C++14
77 / 100
193 ms12996 KiB
#include <stdlib.h> #include <stdio.h> #include "grader.h" #include "lang.h" #include <bits/stdc++.h> using namespace std; int cnt[60][65535], cnt2[65535], sum[60], sum2; void excerpt(int *E) { for (int i=0; i<100; ++i) ++cnt2[E[i]]; sum2=100; pair<double, int> ans={1e9, 0}; set<int> st(E, E+100); for (int i=0; i<56; ++i){ if (sum[i]==0) continue; double cur=1, diff=0; for (int j:st){ double r=(double)cnt[i][j]/(double)sum[i], r2=(double)cnt2[j]/(double)sum2; cur-=r; diff+=fabs(r-r2); } diff+=cur; ans=min(ans, {diff, i}); } int real=language(ans.second); for (int i=0; i<100; ++i) cnt2[E[i]]=0; for (int i=0; i<100; ++i) ++cnt[real][E[i]]; sum[real]+=100; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...