#include "advisor.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int n;
void ComputeAdvice(int* C, int _N, int K, int M) {
n = _N;
int bit = 31 - __builtin_clz(n - 1);
for (int j = 0;j < n;j++) {
for (int i = bit;i >= 0;i--) {
WriteAdvice((C[j] >> i) & 1);
}
}
}
#include "assistant.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int n;
bool in[100100];
queue<int> q[100100];
void Assist(unsigned char* A, int _N, int K, int R) {
n = _N;
int bit = 31 - __builtin_clz(n - 1);
for (int i = 0;i < R; i += bit) {
int now = 0;
for (int j = i;j < i + bit;j++) now = (now << 1) | A[j];
q[now].push(i / bit);
}
for (int i = 0;i < n;i++) q[i].push(n), in[i] = 1;
set<pair<int, int>, greater<pair<int, int>>> s;
for (int i = 0;i < K;i++) s.insert({ q[i].front(), i });
for (int i = 0;i < n;i++) {
int req = GetRequest();
int prev = q[req].front();
q[req].pop();
if (in[req]) {
s.erase({ prev, req });
s.insert({ q[req].front(), req });
continue;
}
auto x = s.begin();
PutBack(x->second);
in[x->second] = 0;
s.erase(x);
in[req] = 1;
s.insert({ q[req].front(), req });
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
30 ms |
68124 KB |
Error - Not putting back color when it is not on the scaffold |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
46 ms |
69116 KB |
Error - Not putting back color when it is not on the scaffold |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
203 ms |
79888 KB |
Error - Not putting back color when it is not on the scaffold |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
33 ms |
68136 KB |
Error - advice is too long |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
254 ms |
82536 KB |
Error - Not putting back color when it is not on the scaffold |
2 |
Incorrect |
262 ms |
82584 KB |
Error - Not putting back color when it is not on the scaffold |
3 |
Incorrect |
266 ms |
82692 KB |
Error - Not putting back color when it is not on the scaffold |
4 |
Incorrect |
244 ms |
82584 KB |
Error - Not putting back color when it is not on the scaffold |
5 |
Incorrect |
257 ms |
82764 KB |
Error - Not putting back color when it is not on the scaffold |
6 |
Incorrect |
242 ms |
82836 KB |
Error - Not putting back color when it is not on the scaffold |
7 |
Incorrect |
245 ms |
82576 KB |
Error - Not putting back color when it is not on the scaffold |
8 |
Incorrect |
248 ms |
82576 KB |
Error - Not putting back color when it is not on the scaffold |
9 |
Incorrect |
248 ms |
82752 KB |
Error - Not putting back color when it is not on the scaffold |
10 |
Incorrect |
244 ms |
82840 KB |
Error - Not putting back color when it is not on the scaffold |