#include "advisor.h"
#include<bits/stdc++.h>
using namespace std;
bitset<500100>onf;
void RADV(int y,int bt){
for(int i=0;i<bt;i++)
WriteAdvice(y&1<<i);
}
void ComputeAdvice(int *C, int N, int K, int M) {
vector<int>nxt(N),lst(N,N),plat(K);
iota(plat.begin(),plat.end(),0);
C[N]=N;
for(int i=N;i--;)
nxt[i]=lst[C[i]],
lst[C[i]]=i;
set<pair<int,int>> st;
for(auto i:plat)onf[i]=1,
st.insert({lst[i],i});
int df=log2(2*K-1);
for(int i=0;i<N;i++){
if(onf[C[i]])continue;
onf[C[i]]=1;
auto[x,y]=*--st.end();
st.erase({x,y});
st.insert({nxt[i],y});
onf[C[x]]=0;
RADV(y,df);
}
}
#include "assistant.h"
#include<bits/stdc++.h>
using namespace std;
bitset<500100>on;
void Assist(unsigned char *A, int N, int K, int R) {
vector<int>platter(K);
iota(platter.begin(),platter.end(),0);
for(auto i:platter)on[i]=1;
int C=0,yy=log2(2*K-1);
for(int i=0;i<N;i++){
int x=GetRequest();
if(on[x]) continue;
int k=0;
for(int c=0;c<yy;c++)
k+=A[c+C]<<c;
C+=yy;
PutBack(platter[k]);
on[platter[k]]=0;
platter[k]=x;
on[x]=1;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1040 KB |
Output is correct |
2 |
Incorrect |
0 ms |
800 KB |
Error - advice must be 0 or 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
1108 KB |
Error - advice must be 0 or 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
3552 KB |
Error - advice must be 0 or 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
912 KB |
Error - advice must be 0 or 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
12 ms |
4124 KB |
Error - advice must be 0 or 1 |
2 |
Incorrect |
11 ms |
4104 KB |
Error - advice must be 0 or 1 |
3 |
Incorrect |
12 ms |
4252 KB |
Error - advice must be 0 or 1 |
4 |
Incorrect |
12 ms |
4384 KB |
Error - advice must be 0 or 1 |
5 |
Incorrect |
12 ms |
4348 KB |
Error - advice must be 0 or 1 |
6 |
Incorrect |
12 ms |
4372 KB |
Error - advice must be 0 or 1 |
7 |
Incorrect |
11 ms |
4380 KB |
Error - advice must be 0 or 1 |
8 |
Incorrect |
11 ms |
4400 KB |
Error - advice must be 0 or 1 |
9 |
Incorrect |
11 ms |
4380 KB |
Error - advice must be 0 or 1 |
10 |
Incorrect |
16 ms |
4384 KB |
Error - advice must be 0 or 1 |