Submission #18819

# Submission time Handle Problem Language Result Execution time Memory
18819 2016-02-15T22:09:06 Z ggoh Last supper (IOI12_supper) C++
0 / 100
88 ms 5568 KB
#include "advisor.h"
int late[100002],color[100002];

void ComputeAdvice(int *C, int N, int K, int M)
{
    for(int i=0;i<N;i++)color[i]=C[i],late[i]=-1;
    for(int i=0;i<N;i++)
    {
        late[color[i]]=i;
    }
    for(int i=0;i<K;i++)
    {
        if(late[i]==-1)WriteAdvice(1);
        else WriteAdvice(0);
    }
    for(int i=0;i<N;i++)
    {
        if(late[color[i]]==i)
        {
            WriteAdvice(1);
        }
        else WriteAdvice(0);
    }
}


#include "assistant.h"
int check,o,go[100002],T[100002],ch[100002],p,st[100002],sz,t;
void Assist(unsigned char *A, int N, int K, int R)
{
    for(int i=0;i<N;i++)go[i]=-1;
    for(int i=0;i<K;i++)
    {
        st[i]=i;
        go[i]=i;
        if(A[i]==0)
        {
            ch[i]=0;
        }
        else
        {
            ch[i]=1;
            T[sz++]=i;
        }
    }
    for(int i=0;i<N;i++)
    {
        p=GetRequest();
        check=A[K+i];
        if(go[p]!=-1)
        {
            if(check)ch[go[p]]=1,T[sz++]=go[p];
        }
        else
        {
            if(sz)
            {
                sz--;
                PutBack(st[T[sz]]);
                go[st[T[sz]]]=-1;
                st[T[sz]]=p;
                ch[T[sz]]=check;
                go[p]=T[sz];
            }
            else
            {
                PutBack(st[0]);
                go[st[0]]=-1;
                st[0]=p;
                ch[0]=check;
                go[p]=0;
            }
        }
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 656 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 1576 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 62 ms 4484 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 4512 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 88 ms 5496 KB Output isn't correct - not an optimal way
2 Incorrect 71 ms 5560 KB Output isn't correct - not an optimal way
3 Incorrect 70 ms 5568 KB Output isn't correct - not an optimal way
4 Incorrect 81 ms 5568 KB Output isn't correct - not an optimal way
5 Incorrect 72 ms 5568 KB Output isn't correct - not an optimal way
6 Incorrect 69 ms 5568 KB Output isn't correct - not an optimal way
7 Incorrect 78 ms 5568 KB Output isn't correct - not an optimal way
8 Incorrect 71 ms 5568 KB Output isn't correct - not an optimal way
9 Incorrect 70 ms 5568 KB Output isn't correct - not an optimal way
10 Correct 71 ms 5568 KB Output is correct - 125000 bits used