#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>>i&1);
}
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+5;
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]]){
auto [x,y]=*st.lower_bound({i,0});
st.erase({x,y});
st.insert({nxt[i],y});
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 |
796 KB |
Output is correct |
2 |
Correct |
1 ms |
796 KB |
Output is correct |
3 |
Correct |
1 ms |
784 KB |
Output is correct |
4 |
Correct |
2 ms |
824 KB |
Output is correct |
5 |
Correct |
1 ms |
844 KB |
Output is correct |
6 |
Correct |
5 ms |
1144 KB |
Output is correct |
7 |
Correct |
3 ms |
976 KB |
Output is correct |
8 |
Correct |
5 ms |
1308 KB |
Output is correct |
9 |
Correct |
9 ms |
1160 KB |
Output is correct |
10 |
Correct |
5 ms |
1128 KB |
Output is correct |
11 |
Correct |
6 ms |
1136 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
1524 KB |
Output is correct |
2 |
Correct |
75 ms |
3808 KB |
Output is correct |
3 |
Correct |
141 ms |
11348 KB |
Output is correct |
4 |
Correct |
87 ms |
7336 KB |
Output is correct |
5 |
Correct |
142 ms |
9128 KB |
Output is correct |
6 |
Correct |
132 ms |
9884 KB |
Output is correct |
7 |
Correct |
124 ms |
9572 KB |
Output is correct |
8 |
Correct |
156 ms |
9968 KB |
Output is correct |
9 |
Correct |
86 ms |
6100 KB |
Output is correct |
10 |
Correct |
121 ms |
9572 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
113 ms |
7748 KB |
Output is correct |
2 |
Correct |
162 ms |
9428 KB |
Output is correct |
3 |
Correct |
157 ms |
9400 KB |
Output is correct |
4 |
Correct |
114 ms |
9264 KB |
Output is correct |
5 |
Correct |
95 ms |
7640 KB |
Output is correct |
6 |
Correct |
136 ms |
9392 KB |
Output is correct |
7 |
Correct |
159 ms |
9668 KB |
Output is correct |
8 |
Correct |
191 ms |
12036 KB |
Output is correct |
9 |
Correct |
78 ms |
7576 KB |
Output is correct |
10 |
Correct |
137 ms |
9460 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
796 KB |
Error - advice is too long |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
136 ms |
9524 KB |
Output is partially correct - 772365 bits used |
2 |
Correct |
151 ms |
9592 KB |
Output is partially correct - 742095 bits used |
3 |
Correct |
124 ms |
9616 KB |
Output is partially correct - 712470 bits used |
4 |
Correct |
149 ms |
9400 KB |
Output is partially correct - 712005 bits used |
5 |
Correct |
155 ms |
9380 KB |
Output is partially correct - 710610 bits used |
6 |
Correct |
162 ms |
9464 KB |
Output is partially correct - 712155 bits used |
7 |
Correct |
157 ms |
9404 KB |
Output is partially correct - 711090 bits used |
8 |
Correct |
127 ms |
9484 KB |
Output is partially correct - 713340 bits used |
9 |
Correct |
122 ms |
9588 KB |
Output is partially correct - 712830 bits used |
10 |
Correct |
184 ms |
11948 KB |
Output is partially correct - 1117620 bits used |