# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
361920 | 2021-02-01T07:00:32 Z | benedict0724 | Last supper (IOI12_supper) | C++17 | 23 ms | 8960 KB |
#include "advisor.h" #include <deque> #include <queue> using namespace std; deque<int> useWhen[5000]; queue<int> ret; int shelf[5000]; void ComputeAdvice(int *C, int N, int K, int M) { int logN = 0; while(N + 1 <= (1<<logN)) logN++; for(int i=0;i<K;i++){ shelf[i] = i; } for(int i=0;i<N;i++){ useWhen[C[i]].push_back(i); } for(int i=0;i<N;i++){ bool flag = false; for(int j=0;j<K;j++){ if(shelf[j] == C[i]) flag = true; } if(!flag){ int m = 0; for(int j=0;j<K;j++){ while(useWhen[shelf[j]].front() < i) useWhen[shelf[j]].pop_front(); if(useWhen[shelf[m]].front() < useWhen[shelf[j]].front()) m = j; } shelf[m] = C[i]; ret.push(C[i]); } else{ ret.push((1<<logN) - 1); } } while(!ret.empty()){ int now = ret.front(); ret.pop(); for(int i=0;i<logN;i++){ if((1<<i) & now) WriteAdvice(1); else WriteAdvice(0); } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 7 ms | 7276 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 11 ms | 7532 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 18 ms | 8428 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 11 ms | 7276 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 21 ms | 8684 KB | Execution killed with signal 11 |
2 | Runtime error | 21 ms | 8684 KB | Execution killed with signal 11 |
3 | Runtime error | 22 ms | 8684 KB | Execution killed with signal 11 |
4 | Runtime error | 22 ms | 8684 KB | Execution killed with signal 11 |
5 | Runtime error | 23 ms | 8960 KB | Execution killed with signal 11 |
6 | Runtime error | 21 ms | 8684 KB | Execution killed with signal 11 |
7 | Runtime error | 21 ms | 8684 KB | Execution killed with signal 11 |
8 | Runtime error | 21 ms | 8684 KB | Execution killed with signal 11 |
9 | Runtime error | 21 ms | 8684 KB | Execution killed with signal 11 |
10 | Runtime error | 21 ms | 8684 KB | Execution killed with signal 11 |