Submission #8124

# Submission time Handle Problem Language Result Execution time Memory
8124 2014-08-30T14:44:45 Z gs13105 Languages (IOI10_languages) C++
100 / 100
4497 ms 112616 KB
#include <cmath>
#include <string.h>
#include "grader.h"
#include "lang.h"

unsigned short pre3[56][1048576];
unsigned short num3[1048576];
int pre1[65536][56];
int num1[65536];
double now[56];
const unsigned int mod=1048575;

void excerpt(int *E)
{
    int c,r,mxnum=0,i,j;
    unsigned int p3[98];
    double z,mx;
    memset(now,0,sizeof(now));
	p3[0]=(E[0]<<10^E[1]<<5^E[2])&mod;
	c=num3[p3[0]];
    if(c!=0)
    {
        for(j=0;j<56;j++)
        {
            z=cbrt(pre3[j][p3[0]]);
            now[j]+=2*z*z/(c+1);
        }
    }
    for(i=1;i<98;i++)
    {
        p3[i]=(p3[i-1]<<5^E[i+2])&mod;
        c=num3[p3[i]];
        if(c!=0)
        {
            for(j=0;j<56;++j)
            {
                z=cbrt(pre3[j][p3[i]]);
                now[j]+=z*z/(c+2);
            }
        }
    }
    for(i=0;i<100;i++)
    {
        if(num1[E[i]]!=0)
        {
            for(j=0;j<56;++j)
            {
                z=cbrt(pre1[E[i]][j]);
                now[j]+=z*z/num1[E[i]];
            }
        }
    }
    mx=now[0];
    for(i=1;i<56;i++)
    {
        if(now[i]>mx)
        {
            mx=now[i];
            mxnum=i;
        }
    }
    r=language(mxnum);
    for(i=0;i<98;i++)
    {
        num3[p3[i]]++;
        pre3[r][p3[i]]++;
		
    }
    for(i=0;i<100;i++)
    {
        num1[E[i]]++;
        pre1[E[i]][r]++;
    }
}
# Verdict Execution time Memory Grader output
1 Correct 4497 ms 112448 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4090 ms 112616 KB Output is correct - 91.72%