#include "advisor.h"
#include<bits/stdc++.h>
using namespace std;
bitset<500100>onf;
void ComputeAdvice(int *C, int N, int K, int M) {
vector<int>nxt(N),lst(N,N),plat(K),dead(N+K,N);
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+N});
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();
dead[y]=i;
st.erase({x,y});
st.insert({nxt[i],i});
onf[C[x]]=0;
}
for(int i=0;i<K;i++)
nxt.push_back(lst[i]);
for(int i=0;i<N+K;i++)
WriteAdvice(dead[i]<nxt[i]);
}
Compilation message
advisor.cpp: In function 'void ComputeAdvice(int*, int, int, int)':
advisor.cpp:16:9: warning: unused variable 'df' [-Wunused-variable]
16 | int df=log2(2*K-1);
| ^~
/usr/bin/ld: /tmp/ccxvUsKj.o: in function `main':
assistant_grader.cpp:(.text.startup+0x21e): undefined reference to `Assist(unsigned char*, int, int, int)'
collect2: error: ld returned 1 exit status