Submission #1018093

# Submission time Handle Problem Language Result Execution time Memory
1018093 2024-07-09T14:09:28 Z socpite Languages (IOI10_languages) C++14
45 / 100
267 ms 8272 KB
#include<bits/stdc++.h>
using namespace std;

#include "grader.h"
#include "lang.h"

const int lang_cnt = 56;
const int char_cnt = (1<<16);

int app[char_cnt];
int vis[lang_cnt];

int total[lang_cnt][char_cnt];
int cnt;

void excerpt(int *E) {
   map<int, int> mp;
   for(int i = 0; i < 100; i++)mp[E[i]]++;
   long double best = 0;
   int pos = 0;
   for(int i = 0; i < lang_cnt; i++){
      if(!vis[i])continue;
      long double sum = 0;
      for(auto v: mp){
         if(total[i][v.first])sum += (long double)v.second*total[i][v.first]*cnt/app[v.first];
      }
      if(sum > best){
         best = sum;
         pos = i;
      }
   }
   int id = language(pos);
   if(!vis[id])cnt += (vis[id] = 1);
   for(auto v: mp){
      if(!total[id][v.first])app[v.first]++;
      total[id][v.first] += v.second;
   }
}
# Verdict Execution time Memory Grader output
1 Correct 251 ms 8272 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 267 ms 8272 KB Output is partially correct - 43.05%