#include<cstdio>
#include<string.h>
#include"grader.h"
#include"lang.h"
#define MOD 262144
int lang_freq[60][70000];
long long lang_flow1[60][270000];
long long lang_flow2[60][270000];
long long f1(int a,int b)
{
return ((a<<10)^b)%MOD;
}
long long f2(int a,int b,int c)
{
return ((a<<20)^(b<<10)^c)%MOD;
}
void excerpt(int *E)
{
int ans=0,ansp=0;
int pos[60]={0};
for(int i=0;i<56;i++)
{
for(int j=0;j<100;j++)
{
pos[i]+=lang_freq[i][E[j]];
if(j>0)pos[i]+=lang_flow1[i][f1(E[j-1],E[j])];
if(j>1)pos[i]+=lang_flow2[i][f2(E[j-2],E[j-1],E[j])];
}
if(ansp<pos[i])ansp=pos[i],ans=i;
}
int lang=language(ans);
for(int i=0;i<100;i++)
{
lang_freq[lang][E[i]]++;
if(i>0)
{
lang_flow1[lang][f1(E[i-1],E[i])]++;
}
if(i>1)
{
lang_flow2[lang][f2(E[i-2],E[i-1],E[i])]++;
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
34 ms |
5120 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
34 ms |
5248 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |