#include "advisor.h"
#include <bits/stdc++.h>
using namespace std;
typedef pair <int, int> pii;
static int P[101010], K[101010];
static priority_queue <pii> Q;
void ComputeAdvice(int *C, int n, int k, int m)
{
int i;
for(i=0; i<n; i++) P[i] = n + 1;
for(i=n-1; i>=0; i--){
K[k + i] = P[C[i]];
P[C[i]] = i;
}
for(i=0; i<k; i++){
K[i] = P[i];
P[i] = i;
Q.push(pii(K[i], i));
}
for(i=0; i<n; i++){
WriteAdvice(Q.top().second); Q.pop();
Q.push(pii(K[k + i], k + i));
}
}
#include "assistant.h"
#include <bits/stdc++.h>
using namespace std;
static queue <int> Q;
static bool chk[101010];
void Assist(unsigned char *A, int n, int k, int r)
{
int i, c;
for(i=0; i<k; i++){
if(A[i]) Q.push(i);
chk[i] = 1;
}
for(i=0; i<n; i++){
c = GetRequest();
if(!chk[c]){
chk[Q.front()] = 0;
PutBack(Q.front());
Q.pop();
}
if(A[k + i]) Q.push(c);
chk[c] = 1;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
752 KB |
Error - advice must be 0 or 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
1120 KB |
Error - advice must be 0 or 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
20 ms |
4104 KB |
Error - advice must be 0 or 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
4104 KB |
Error - advice must be 0 or 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
24 ms |
4352 KB |
Error - advice must be 0 or 1 |
2 |
Incorrect |
24 ms |
4352 KB |
Error - advice must be 0 or 1 |
3 |
Incorrect |
20 ms |
4352 KB |
Error - advice must be 0 or 1 |
4 |
Incorrect |
19 ms |
4352 KB |
Error - advice must be 0 or 1 |
5 |
Incorrect |
23 ms |
4352 KB |
Error - advice must be 0 or 1 |
6 |
Incorrect |
27 ms |
4352 KB |
Error - advice must be 0 or 1 |
7 |
Incorrect |
22 ms |
4352 KB |
Error - advice must be 0 or 1 |
8 |
Incorrect |
24 ms |
4352 KB |
Error - advice must be 0 or 1 |
9 |
Incorrect |
24 ms |
4352 KB |
Error - advice must be 0 or 1 |
10 |
Incorrect |
25 ms |
4352 KB |
Error - advice must be 0 or 1 |