Submission #18816

# Submission time Handle Problem Language Result Execution time Memory
18816 2016-02-15T22:02:18 Z ggoh Last supper (IOI12_supper) C++
0 / 100
2163 ms 5504 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,ch[100002],p,st[100002],sz,t;
void Assist(unsigned char *A, int N, int K, int R)
{
    for(int i=0;i<K;i++)
    {
        st[i]=i;
        if(A[i]==0)
        {
            ch[i]=0;
        }
        else
        {
            ch[i]=1;
        }
    }
    for(int i=0;i<N;i++)
    {
        p=GetRequest();
        check=A[K+i];
        o=0;
        int j;
        for(j=0;j<K;j++)
        {
            if(st[j]==p)
            {
                o=1;break;
            }
        }
        if(o==1)
        {
            if(check)ch[j]=1;
        }
        else
        {
            o=0;
            for(j=0;j<K;j++)
            {
                if(ch[j]==1)
                {
                    o=1;break;
                }
            }
            if(o==1)
            {
                PutBack(st[j]);
                st[j]=p;
                ch[j]=check;
            }
            else
            {
                PutBack(st[0]);
                st[0]=p;
                ch[0]=check;
            }
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 608 KB Output is correct
2 Correct 4 ms 720 KB Output is correct
3 Correct 4 ms 824 KB Output is correct
4 Incorrect 6 ms 856 KB Output isn't correct - not an optimal way
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 29 ms 1232 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1309 ms 4912 KB Output is correct
2 Correct 1905 ms 5288 KB Output is correct
3 Correct 2073 ms 5320 KB Output is correct
4 Correct 2021 ms 5320 KB Output is correct
5 Incorrect 1580 ms 5320 KB Output isn't correct - not an optimal way
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 12 ms 5320 KB Output is correct
2 Correct 15 ms 5320 KB Output is correct
3 Correct 8 ms 5320 KB Output is correct
4 Incorrect 7 ms 5320 KB Output isn't correct - not an optimal way
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1769 ms 5464 KB Output isn't correct - not an optimal way
2 Correct 1930 ms 5504 KB Output is correct - 122000 bits used
3 Correct 2053 ms 5504 KB Output is correct - 125000 bits used
4 Correct 2040 ms 5504 KB Output is correct - 125000 bits used
5 Correct 2013 ms 5504 KB Output is correct - 125000 bits used
6 Correct 2045 ms 5504 KB Output is correct - 125000 bits used
7 Correct 2002 ms 5504 KB Output is correct - 124828 bits used
8 Correct 2046 ms 5504 KB Output is correct - 124910 bits used
9 Correct 2037 ms 5504 KB Output is correct - 125000 bits used
10 Correct 2163 ms 5504 KB Output is correct - 125000 bits used