Submission #18815

#TimeUsernameProblemLanguageResultExecution timeMemory
18815ggohLast supper (IOI12_supper)C++98
0 / 100
264 ms13280 KiB
#include "advisor.h" int o,ch[100002],go[100002],late[100002],st[100002],color[100002]; void write(int q) { int pp=o; while(pp) { WriteAdvice(q%2); pp--; q/=2; } } void ComputeAdvice(int *C, int N, int K, int M) { int u=K,p; int t=0,sz=0,on; u--; while(u) { u/=2;o++; } if(K==1)o=1; for(int i=0;i<N;i++)color[i]=C[i],late[i]=-1; t=0; for(int i=0;i<N;i++) { late[color[i]]=i; } for(int i=0;i<K;i++) { ch[i]=1; on=i; go[i]=i; if(late[i]==-1)st[t++]=i; } for(int i=0;i<N;i++) { if(ch[color[i]]==1) { if(late[color[i]]==i) { late[color[i]]=-1; st[t++]=color[i]; } } else { if(t) { t--; write(go[st[t]]); go[color[i]]=go[st[t]]; ch[st[t]]=0; ch[color[i]]=1; on=color[i]; } else { write(go[on]); go[color[i]]=go[on]; ch[on]=0; on=color[i]; ch[on]=1; } if(late[color[i]]==i) { late[color[i]]=-1; st[t++]=color[i]; } } } }
#include "assistant.h" int ch[100002],st[100002]; void Assist(unsigned char *A, int N, int K, int R) { int o=0,p,u=K,r; u--; while(u) { u/=2;o++; } if(K==1)o=1; for(int i=0;i<K;i++)st[i]=i,ch[i]=1; u=0; for(int i=0;i<N;i++) { p=GetRequest(); if(ch[p])continue; r=0; for(int j=0;j<o;j++) { r+=A[u+j]*(1<<j); } PutBack(st[r]); ch[st[r]]=0; st[r]=p; ch[p]=1; } }

Compilation message (stderr)

advisor.cpp: In function 'void ComputeAdvice(int*, int, int, int)':
advisor.cpp:16:13: warning: unused variable 'p' [-Wunused-variable]
     int u=K,p;
             ^
advisor.cpp:17:13: warning: unused variable 'sz' [-Wunused-variable]
     int t=0,sz=0,on;
             ^~
advisor.cpp:17:18: warning: 'on' may be used uninitialized in this function [-Wmaybe-uninitialized]
     int t=0,sz=0,on;
                  ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...