Submission #1016744

# Submission time Handle Problem Language Result Execution time Memory
1016744 2024-07-08T11:35:07 Z huutuan Languages (IOI10_languages) C++14
100 / 100
651 ms 80208 KB
#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 time Memory Grader output
1 Correct 651 ms 80208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 591 ms 80108 KB Output is correct - 91.16%