#include "advisor.h"
#include <bits/stdc++.h>
using namespace std;
typedef pair <int, int> pii;
static int P[151515], K[151515];
static priority_queue <pii> Q;
static bool chk[151515], ans[151515];
void ComputeAdvice(int *C, int n, int k, int m)
{
int i;
for(i=0; i<n; i++) P[i] = n + k + 1;
for(i=n-1; i>=0; i--){
K[k + i] = P[C[i]];
P[C[i]] = k + i;
}
for(i=0; i<k; i++){
K[i] = P[i];
P[i] = i; chk[i] = 1;
Q.push(pii(K[i], i));
}
for(i=0; i<n; i++){
if(!chk[C[i]]){
chk[Q.top().second] = 0;
ans[Q.top().second] = 1;
Q.pop(); Q.push(pii(K[k + i], k + i));
chk[C[i]] = 1;
}
}
for(i=0; i<n+k; i++){
WriteAdvice(ans[i]);
}
}
#include "assistant.h"
#include <bits/stdc++.h>
using namespace std;
static vector <int> V;
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]) V.push_back(i);
chk[i] = 1;
}
for(i=0; i<n; i++){
c = GetRequest();
if(!chk[c]){
chk[V.back()] = 0;
PutBack(V.back());
V.pop_back();
}
if(A[k + i]) V.push_back(c);
chk[c] = 1;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
744 KB |
Output is correct |
2 |
Incorrect |
5 ms |
968 KB |
Error - Putting back a color that is not on the scaffold |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
14 ms |
1512 KB |
Error - Putting back a color that is not on the scaffold |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
80 ms |
5648 KB |
Error - Putting back a color that is not on the scaffold |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
12 ms |
5648 KB |
Error - Putting back a color that is not on the scaffold |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
93 ms |
6728 KB |
Error - Putting back a color that is not on the scaffold |
2 |
Incorrect |
102 ms |
6904 KB |
Error - Putting back a color that is not on the scaffold |
3 |
Incorrect |
102 ms |
6904 KB |
Error - Putting back a color that is not on the scaffold |
4 |
Incorrect |
81 ms |
6904 KB |
Error - Putting back a color that is not on the scaffold |
5 |
Incorrect |
96 ms |
7064 KB |
Error - Putting back a color that is not on the scaffold |
6 |
Incorrect |
89 ms |
7064 KB |
Error - Putting back a color that is not on the scaffold |
7 |
Incorrect |
88 ms |
7064 KB |
Error - Putting back a color that is not on the scaffold |
8 |
Incorrect |
83 ms |
7064 KB |
Error - Putting back a color that is not on the scaffold |
9 |
Incorrect |
92 ms |
7128 KB |
Error - Putting back a color that is not on the scaffold |
10 |
Correct |
116 ms |
7128 KB |
Output is correct - 125000 bits used |