#include "advisor.h"
#include<bits/stdc++.h>
using namespace std;
void ComputeAdvice(int *C, int N, int K, int M) {
int T = log2(N) + 1;
for(int i = 0; i < N; i++) {
for(int j = 0; j < T; j++) WriteAdvice(C[i] >> j & 1);
}
}
#include "assistant.h"
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int query[N];
bool chosen[N];
vector<int> nxt[N];
void Assist(unsigned char *A, int N, int K, int R) {
int T = log2(N) + 1;
int cnt = 0;
for(int i = 0; i < N; i++) {
for(int j = 0; j < T; j++) {
if (int(A[cnt])) query[i] |= (1 << j);
cnt++;
}
}
for(int i = N - 1; i >= 0; i--) nxt[query[i]].push_back(i);
priority_queue<pair<int, int> > Q;
for(int i = 0; i < K; i++) {
int tmp = nxt[i].empty() ? N : nxt[i].back();
Q.push({tmp, i});
chosen[i] = 1;
}
// for(int i = 0; i < N; i++) {
// GetRequest();
// int x = query[i];
// if (chosen[x] == 0) {
// if (Q.empty()) return;
// int useless, j; tie(useless, j) = Q.top(); Q.pop();
// chosen[j] = 0;
// PutBack(j);
//
// chosen[x] = 1;
// if (nxt[x].empty()) return;
// nxt[x].pop_back();
// int tmp = nxt[x].empty() ? N : nxt[i].back();
// Q.push({tmp, x});
// }
// }
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
3096 KB |
Error - GetRequest() must be called N times |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
24 ms |
4444 KB |
Error - GetRequest() must be called N times |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
221 ms |
15220 KB |
Error - GetRequest() must be called N times |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
3084 KB |
Error - advice is too long |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
277 ms |
18124 KB |
Error - GetRequest() must be called N times |
2 |
Incorrect |
268 ms |
18092 KB |
Error - GetRequest() must be called N times |
3 |
Incorrect |
269 ms |
17900 KB |
Error - GetRequest() must be called N times |
4 |
Incorrect |
266 ms |
18148 KB |
Error - GetRequest() must be called N times |
5 |
Incorrect |
270 ms |
18084 KB |
Error - GetRequest() must be called N times |
6 |
Incorrect |
292 ms |
18132 KB |
Error - GetRequest() must be called N times |
7 |
Incorrect |
266 ms |
18144 KB |
Error - GetRequest() must be called N times |
8 |
Incorrect |
272 ms |
17952 KB |
Error - GetRequest() must be called N times |
9 |
Incorrect |
282 ms |
18056 KB |
Error - GetRequest() must be called N times |
10 |
Incorrect |
271 ms |
19744 KB |
Error - GetRequest() must be called N times |