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 <stdlib.h>
#include <stdio.h>
#include <bits/stdc++.h>
#include "grader.h"
#include "lang.h"
#define SZ 100
#define X 1000100
using namespace std;
typedef pair<int,int> P;
map<int,int> M2;
map<string,int> M3;
int O[X][60],D[X][60],T[X][60];
int F[100],G[100],cnt2=0,cnt3=0;
long long ans[60];
int id2(int x,int y){
int pa=x*65536+y;
if (M2.find(pa)!=M2.end())return M2[pa];
return M2[pa]=cnt2++;
}
string its(int x){
string str="";
for (int i=5;i>=0;i--){
str+=(char)(x/(1<<i)+48);
x%=(1<<i);
}
return str;
}
int id3(int x,int y,int z){
string ta=its(x)+its(y)+its(z);
if (M3.find(ta)!=M3.end())return M3[ta];
return M3[ta]=cnt3++;
}
void excerpt(int *E) {
int mx=0;
memset(ans,0,sizeof(ans));
for (int i=0;i<SZ-1;i++)
F[i]=id2(E[i],E[i+1]);
for (int i=0;i<SZ-2;i++)
G[i]=id3(E[i],E[i+1],E[i+2]);
for (int i=0;i<SZ;i++)
for (int j=0;j<56;j++)
if (O[E[i]][j]==1)ans[j]+=1;
for (int i=0;i<SZ-1;i++)
for (int j=0;j<56;j++)
if (D[F[i]][j]==1)ans[j]+=2;
for (int i=0;i<SZ-2;i++)
for (int j=0;j<56;j++)
if (T[G[i]][j]==1)ans[j]+=5;
for (int i=0;i<56;i++)
if (ans[i]>ans[mx])mx=i;
int s = language(mx);
for (int i=0;i<SZ;i++){
O[E[i]][s]=1;
if (i<SZ-1)D[F[i]][s]=1;
if (i<SZ-2)T[G[i]][s]=1;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |