Submission #8123

# Submission time Handle Problem Language Result Execution time Memory
8123 2014-08-30T14:18:30 Z gs13105 Languages (IOI10_languages) C++
96 / 100
3089 ms 15084 KB
#include <cmath>
#include <string.h>
#include "grader.h"
#include "lang.h"

int pre[56][65536];
int num[65536];
double now[56];

void excerpt(int *E)
{
    int c,r,mxnum=0,i,j;
    unsigned short p[98];
    double z,mx;
    memset(now,0,sizeof(now));
	p[0]=E[0]<<8^E[1]<<4^E[2];
	c=num[p[0]];
    if(c!=0)
    {
        for(j=0;j<56;++j)
        {
            z=cbrt(pre[j][p[0]]);
            now[j]+=z*z/c;
        }
    }
    for(i=1;i<98;++i)
    {
        p[i]=p[i-1]<<4^E[i+2];
        c=num[p[i]];
        if(c!=0)
        {
            for(j=0;j<56;++j)
            {
                z=cbrt(pre[j][p[i]]);
                now[j]+=z*z/c;
            }
        }
    }
    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)
    {
        ++num[p[i]];
        ++pre[r][p[i]];
		
    }
}
# Verdict Execution time Memory Grader output
1 Correct 3089 ms 15016 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 2866 ms 15084 KB Output is partially correct - 87.75%