#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&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;
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;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
780 KB |
Output isn't correct - not an optimal way |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
10 ms |
1492 KB |
Error - Putting back a color that is not on the scaffold |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
97 ms |
7900 KB |
Error - Putting back a color that is not on the scaffold |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
784 KB |
Error - advice is too long |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
144 ms |
9732 KB |
Error - Putting back a color that is not on the scaffold |
2 |
Incorrect |
122 ms |
9352 KB |
Error - Putting back a color that is not on the scaffold |
3 |
Incorrect |
124 ms |
9200 KB |
Error - Putting back a color that is not on the scaffold |
4 |
Incorrect |
120 ms |
9456 KB |
Error - Putting back a color that is not on the scaffold |
5 |
Incorrect |
120 ms |
9456 KB |
Error - Putting back a color that is not on the scaffold |
6 |
Incorrect |
136 ms |
9460 KB |
Error - Putting back a color that is not on the scaffold |
7 |
Incorrect |
117 ms |
9448 KB |
Error - Putting back a color that is not on the scaffold |
8 |
Incorrect |
127 ms |
9424 KB |
Error - Putting back a color that is not on the scaffold |
9 |
Incorrect |
133 ms |
9376 KB |
Error - Putting back a color that is not on the scaffold |
10 |
Incorrect |
155 ms |
9632 KB |
Error - Putting back a color that is not on the scaffold |