Submission #15788

# Submission time Handle Problem Language Result Execution time Memory
15788 2015-07-26T13:52:59 Z gs13068 Languages (IOI10_languages) C++
98 / 100
4417 ms 155552 KB
#include "grader.h"
#include "lang.h"
#include <map>
#include <vector>

const int len = 4;

std::map<long long,std::vector<int> > M[len];
double t[56],c[56];

void excerpt(int *E)
{
	std::vector<int> a;
	long long hs,tmp;
    int i,j,k,r;
    for(j=0;j<56;j++)t[j]=0.0;
    for(i=0;i<100;i++)
    {
        hs=0;
        tmp=1;
        for(j=0;j<len&&i+j<100;j++)
		{
			hs=hs*77777LL+E[i+j];
			if(M[j].find(hs)!=M[j].end())
			{
				a=M[j][hs];
				for(k=0;k<56;k++)t[k]+=a[k]*tmp;
			}
			tmp*=111LL;
		}
    }
	r=0;
    for(i=0;i<56;i++)
	{
        //t[i]/=c[i]+1;
        if(t[i]>t[r])r=i;
	}
    r=language(r);
    a.clear();
    a.resize(56,0);
    for(i=0;i<100;i++)
    {
        hs=0;
        for(j=0;j<len&&i+j<100;j++)
		{
			hs=hs*77777LL+E[i+j];
			if(M[j].find(hs)==M[j].end())M[j][hs]=a;
            M[j][hs][r]=1;
		}
    }
}
# Verdict Execution time Memory Grader output
1 Correct 4417 ms 155468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 4211 ms 155552 KB Output is partially correct - 89.30%