#include "advisor.h"
void ComputeAdvice(int *C, int N, int K, int M) {
int x = 1;
while (N > (1 << x)) x++;
for (int i = 0; i < N; i++) {
for (int j = 0; j < x; j++) {
//printf("%c", '0' + !!(C[i] & (1 << j)));
WriteAdvice(!!(C[i] & (1 << j)));
}
}
//printf("\n");
}
#include <bits/stdc++.h>
#include "assistant.h"
#define X first
#define Y second
using namespace std;
const int maxn = 1e5+10;
queue< int > qs[maxn];
void Assist(unsigned char *A, int N, int K, int R) {
int x = 1;
while (N > (1 << x)) x++;
int ptr = 0;
vector< int > c;
for (int i = 0; i < N; i++) {
int ac = 0;
for (int j = 0; j < x; j++) {
//printf("pokusaj: %c\n", A[ptr]);
if (A[ptr++] == 1) ac += (1 << j);
}
c.push_back(ac);
}
printf("\n");
for (int i = 0; i < N; i++) qs[i].push(N + 1);
for (int i = 0; i < N; i++) {
qs[c[i]].push(i);
}
set< pair<int, int> > s;
for (int i = 0; i < K; i++) {
s.insert({qs[i].front(), i});
}
for (int i = 0; i < N; i++) {
int deb = GetRequest();
//printf("debug: %d %d\n", deb, c[i]); fflush(stdout);
assert(c[i] == deb);
int tr = c[i];
if (!s.count({qs[tr].front(), tr})) {
int x = s.rbegin()->Y;
PutBack(x);
s.erase(--s.end());
qs[tr].pop();
s.insert({qs[tr].front(), tr});
} else {
s.erase({qs[tr].front(), tr});
qs[tr].pop();
s.insert({qs[tr].front(), tr});
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
40 ms |
67832 KB |
Hacked |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
67 ms |
69060 KB |
Hacked |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
264 ms |
79696 KB |
Hacked |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
34 ms |
67776 KB |
Error - advice is too long |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
321 ms |
82448 KB |
Hacked |
2 |
Incorrect |
371 ms |
82544 KB |
Hacked |
3 |
Incorrect |
351 ms |
82756 KB |
Hacked |
4 |
Incorrect |
346 ms |
82804 KB |
Hacked |
5 |
Incorrect |
351 ms |
82704 KB |
Hacked |
6 |
Incorrect |
325 ms |
82668 KB |
Hacked |
7 |
Incorrect |
328 ms |
82672 KB |
Hacked |
8 |
Incorrect |
384 ms |
82768 KB |
Hacked |
9 |
Incorrect |
326 ms |
82636 KB |
Hacked |
10 |
Incorrect |
313 ms |
82728 KB |
Hacked |