# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
988839 | 2024-05-26T12:38:08 Z | lalig777 | Last supper (IOI12_supper) | C++14 | 44 ms | 71072 KB |
#include "advisor.h" #include <iostream> #include <vector> #include <unordered_set> #include <queue> using namespace std; void ComputeAdvice(int *C, int N, int K, int M){ int digits; for (int i=0; i<21; i++){ if ((1<<i)>=N-1){ digits=i; break; } } if (K==1) return; unordered_set<int>current; priority_queue<pair<int,int>>next; vector<queue<int>>orden(N); for (int i=0; i<N; i++){ int x=C[i]; if (x<K){ if (!(current.find(x)!=current.end())){ next.push(make_pair(i, x)); current.insert(x); } }orden[x].push(i); }for (int i=0; i<K; i++){ if (!(current.find(i)!=current.end())){ next.push(make_pair(1e9, i)); current.insert(i); } } for (int i=0; i<N; i++){ int x=C[i]; orden[x].pop(); int pos; if (orden[x].empty()) pos=1e9; else pos=orden[x].front(); if (!(current.find(x)!=current.end())){ current.insert(x); int remov=next.top().second; next.pop(); current.erase(remov); for (int j=digits-1; j>=0; j--){ int y=1<<j; if (remov>=y){ remov-=y; WriteAdvice('1'); }else WriteAdvice('0'); } } next.push(make_pair(pos, x)); }return; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 784 KB | Error - advice must be 0 or 1 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 7776 KB | Error - advice must be 0 or 1 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 31 ms | 57168 KB | Error - advice must be 0 or 1 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 3636 KB | Error - advice must be 0 or 1 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 37 ms | 70764 KB | Error - advice must be 0 or 1 |
2 | Incorrect | 36 ms | 71024 KB | Error - advice must be 0 or 1 |
3 | Incorrect | 38 ms | 70840 KB | Error - advice must be 0 or 1 |
4 | Incorrect | 39 ms | 70864 KB | Error - advice must be 0 or 1 |
5 | Incorrect | 37 ms | 71072 KB | Error - advice must be 0 or 1 |
6 | Incorrect | 37 ms | 71048 KB | Error - advice must be 0 or 1 |
7 | Incorrect | 38 ms | 70728 KB | Error - advice must be 0 or 1 |
8 | Incorrect | 37 ms | 70860 KB | Error - advice must be 0 or 1 |
9 | Incorrect | 44 ms | 70920 KB | Error - advice must be 0 or 1 |
10 | Incorrect | 39 ms | 71068 KB | Error - advice must be 0 or 1 |