# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
588172 | Deepesson | Languages (IOI10_languages) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "lang.h"
#include "grader.h"
#define fi first
#define se second
#define pb push_back
using ll = long long;
ll lang[60][66000];
std::unordered_map<int,int> mapa[60];
std::unordered_map<int,int> mapa2[60];
ll tot[60];
ll duptot[60];
ll duptot2[60];
void excerpt(int *E)
{
{
int best=0;double score=0;
for(int i=0;i!=60;++i){
if(!tot[i])continue;
double bonus=0;
/* for(int j=0;j!=100;++j){
bonus+=(double)lang[i][E[j]];
}
bonus/=tot[i];*/
for(int j=0;j!=99;++j){
ll ind = E[j] * 100000 + (E[j+1]);
auto it = mapa[i].find(ind);
if(it!=mapa[i].end())
bonus+=(double)(*it)*8.0;
}
bonus/=(double)duptot[i];
double nbonus=0;
for(int j=0;j!=98;++j){
ll ind = E[j] * 100000 + (E[j+1]);
ind = ind * 100000 + E[j+2];
auto it = mapa2[i].find(ind);
if(it!=mapa2[i].end())
nbonus+=(double)(*it)*16.0;
}
nbonus/=(double)duptot2[i];
bonus+=nbonus;
if(bonus>=score){
best=i;
score=bonus;
continue;
}
}
int k = language(best);
for(int i=0;i!=100;++i){
tot[k]++;
lang[k][E[i]]++;
}
for(int j=0;j!=99;++j){
ll ind = E[j] * 100000 + (E[j+1]);
mapa[k][ind]++;
duptot[k]++;
}
for(int j=0;j!=98;++j){
ll ind = E[j] * 100000 + (E[j+1]);
ind = ind * 100000 + E[j+2];
mapa2[k][ind]++;
duptot2[k]++;
}
}
}