Submission #18832

# Submission time Handle Problem Language Result Execution time Memory
18832 2016-02-15T22:47:18 Z ggoh Last supper (IOI12_supper) C++
Compilation error
0 ms 0 KB
#include "advisor.h"
void ComputeAdvice(int *C, int N, int K, int M)
{
    int L[100002];
    for(int i=0;i<N;i++)L[i]=-1;
    for(int i=0;i<N;i++)L[C[i]]=i;
    for(int i=0;i<K;i++)WriteAdvice((L[i]+1?0:1));
    for(int i=0;i<N;i++)WriteAdvice((L[C[i]]-i?0:1));
}
#include "assistant.h"
int sz,del,p,on,T[100002],c[100002];
void Assist(unsigned char *A, int N, int K, int R)
{
    for(int i=0;i<K;i++)
    {
        c[i]=1;on=i;
        if(A[i])T[sz++]=i;
    }
    for(int i=0;i<N;i++)
    {
        p=GetRequest();
        if(!c[p])
        {
          	del=sz?T[--sz]:on;
           	PutBack(del);
            c[del]=0;c[p]=1;
        }
      	if(A[K+i]T[sz++]=p;
        on=p;
    }
}

Compilation message

assistant.cpp: In function 'void Assist(unsigned char*, int, int, int)':
assistant.cpp:19:11: warning: init-statement in selection statements only available with -std=c++1z or -std=gnu++1z
        if(A[K+i]T[sz++]=p;
           ^
assistant.cpp:19:17: error: expected ';' before 'T'
        if(A[K+i]T[sz++]=p;
                 ^
assistant.cpp:19:16: warning: value computed is not used [-Wunused-value]
        if(A[K+i]T[sz++]=p;
           ~~~~~^
assistant.cpp:19:16: warning: statement has no effect [-Wunused-value]
assistant.cpp:20:13: error: expected ')' before ';' token
         on=p;
             ^
assistant.cpp:20:11: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
         on=p;
         ~~^~