Submission #1012349

# Submission time Handle Problem Language Result Execution time Memory
1012349 2024-07-02T03:19:16 Z huutuan Languages (IOI10_languages) C++14
77 / 100
193 ms 12996 KB
#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 time Memory Grader output
1 Correct 169 ms 12996 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 193 ms 12996 KB Output is partially correct - 71.39%