Submission #11167

# Submission time Handle Problem Language Result Execution time Memory
11167 2014-11-17T11:54:54 Z gs13068 Question (Grader is different from the original contest) (CEOI14_question_grader) C++
100 / 100
1588 ms 25680 KB
static int flag;
static int a[1000];
 
void init()
{
    if(!flag)
    {
        int i,j,k,n=0;
        for(i=0;i<4096;i++)
        {
            k=0;
            for(j=0;j<12;j++)k+=(i>>j)&1;
            if(k==6)a[n++]=i;
        }
        flag=1;
    }
}
 
int encode(int N,int x,int y)
{
    int i;
    init();
    for(i=0;i<12;i++)if(((a[x]>>i)&1)&&!((a[y]>>i)&1))return i+1;
    while(1);
}
static int flag;
static int a[1000];
 
void init()
{
    if(!flag)
    {
        int i,j,k,n=0;
        for(i=0;i<4096;i++)
        {
            k=0;
            for(j=0;j<12;j++)k+=(i>>j)&1;
            if(k==6)a[n++]=i;
        }
        flag=1;
    }
}
 
int decode(int N,int x,int y)
{
    init();
    return (a[x]>>(y-1))&1;
}
# Verdict Execution time Memory Grader output
1 Correct 1588 ms 25680 KB Output is correct - maxh = 12
2 Correct 1495 ms 25680 KB Output is correct - maxh = 12