# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
18815 | 2016-02-15T21:41:05 Z | ggoh | Last supper (IOI12_supper) | C++ | 264 ms | 13280 KB |
#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]; } } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 636 KB | Output is correct |
2 | Incorrect | 4 ms | 1000 KB | Output isn't correct - not an optimal way |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 24 ms | 1920 KB | Output isn't correct - not an optimal way |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 170 ms | 8872 KB | Output isn't correct - not an optimal way |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 8872 KB | Error - advice is too long |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 198 ms | 11160 KB | Output isn't correct - not an optimal way |
2 | Incorrect | 203 ms | 11160 KB | Output isn't correct - not an optimal way |
3 | Incorrect | 196 ms | 11160 KB | Output isn't correct - not an optimal way |
4 | Incorrect | 179 ms | 11160 KB | Output isn't correct - not an optimal way |
5 | Incorrect | 182 ms | 11160 KB | Output isn't correct - not an optimal way |
6 | Incorrect | 182 ms | 11160 KB | Output isn't correct - not an optimal way |
7 | Incorrect | 203 ms | 11160 KB | Output isn't correct - not an optimal way |
8 | Incorrect | 240 ms | 11160 KB | Output isn't correct - not an optimal way |
9 | Incorrect | 193 ms | 11160 KB | Output isn't correct - not an optimal way |
10 | Incorrect | 264 ms | 13280 KB | Output isn't correct - not an optimal way |