#include <stdlib.h>
#include <stdio.h>
#include "grader.h"
#include <bits/stdc++.h>
using namespace std;
#define SZ 100
#define Sc 56
#define LN 65535
int t=0;
int oc[Sc+1][LN+1];
double good[SZ];
int hw[Sc+1];
void New(int *x,int ps=-1){
if(ps>=t){
ps=t;++t;
}
else{
if(ps==-1){
if(t==56){
pair<int,int> sw={-1,-1};
for(int i=0;i<t;++i){
sw=max(sw,{good[i],i});
}
ps=sw.second;
}
else{
ps=t;t++;
}
}
}
for(int i=0;i<SZ;++i){
oc[ps][x[i]]++;
}
hw[ps]++;
}
int hwq=0;
bool fx[SZ+1];
double tok(int x,int y){
return (100.0*(x))/double(y);
}
void excerpt(int *E) {
hwq++;
// cout<<hwq<<endl;
// if(hwq==50)exit(0);
if(hwq==1){
int x=language(0);
New(E,x);
return;
}
for(int i=0;i<t;++i)good[i]=0.0;
int pr=0;
int q=0;
for(int i=0;i<SZ;++i){
// if(E[i]==32)continue;
pr++;
double hv=0.0;
bool h=0;
for(int j=0;j<t;++j){
if(hw[j]!=0)
hv+=(double)oc[j][E[i]]/(double(hw[j])),h=true;
}
if(h==false){
q++;
}
if(hv>0){
for(int j=0;j<t;++j){
if(hw[j]!=0){
double d=(double)oc[j][E[i]]/(double(hw[j]));
good[j]+=(d/hv);
}
}
}
}
double all = 0.0;
for(int i=0;i<t;++i){
all+=good[i];
}
pair<double,int> ld=make_pair(-1,0);
for(int i=0;i<t;++i){
ld=max(ld,make_pair(good[i],i));
}
int x=language(ld.second);
New(E,x);
return;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
547 ms |
2908 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
612 ms |
2980 KB |
Output is partially correct - 77.90% |