이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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];
std::unordered_map<int,int> mapa3[60];
ll tot[60];
ll duptot[60];
ll duptot2[60];
ll duptot3[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;
if(tot[i]>10000){
for(int j=0;j!=100;++j){
if(!lang[i][E[j]]){
bonus-=500;
}
}
}
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->second);
}
bonus/=tot[i];
double kbonus=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())
kbonus+=(double)(it->second)*10.0;
}
kbonus/=(double)duptot2[i];
double nbonus=0;
for(int j=0;j!=97;++j){
ll ind = E[j] * 100000 + (E[j+1]);
ind = ind * 100000 + E[j+2];
ind = ind * 100000 + E[j+3];
auto it = mapa3[i].find(ind);
if(it!=mapa3[i].end())
nbonus+=(double)(it->second)*50.0;
}
nbonus/=(double)duptot3[i];
bonus+=nbonus;
bonus+=kbonus;
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]++;
}
for(int j=0;j!=97;++j){
ll ind = E[j] * 100000 + (E[j+1]);
ind = ind * 100000 + E[j+2];
ind = ind * 100000 + E[j+3];
mapa3[k][ind]++;
duptot3[k]++;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |