#include "advisor.h"
#include <bits/stdc++.h>
using namespace std;
#define dbgv(v) cout<<#v<<" = "; f(i,0,v.size()) cout<<v[i]<<" "; cout<<endl
#define dbga(a,x,y) cout<<#a<<" = "; f(i,x,y) cout<<a[i]<<" "; cout<<endl
#define erorp(x) cout<<#x<<"={"<<x.F<<" , "<<x.S<<"}"<<endl
#define eror(x) cout<<#x<<'='<<(x)<<endl
#define f_(i,a,b) for(int i=a;i>=b;i--)
#define f(i,a,b) for(int i=a;i<b;i++)
#define nb(x) __builtin_popcount(x)
#define all(v) v.begin(),v.end()
#define bit(n,k) (((n)>>(k))&1)
#define Add(x,y) x=(x+y)%mod
#define maxm(a,b) a=max(a,b)
#define minm(a,b) a=min(a,b)
#define lst(x) x[x.size()-1]
#define sz(x) int(x.size())
#define mp make_pair
#define ll long long
#define pb push_back
#define S second
#define F first
const int N=2e5+99;
int n,k,a[N],nxt[N],last[N],ans[N];
void ComputeAdvice(int *C, int n, int k, int M){
WriteAdvice('0');
return ;
iota(last,last+n,n);
f_(i,n-1,0){
nxt[i]=last[C[i]];
last[C[i]]=i;
}
set<int> s;
f(i,0,k) s.insert(last[i]);
fill(last,last+n,-1);
f(i,0,n){
if(*s.lower_bound(i)==i){
s.erase(i);
}
else{
int col;
if(*s.rbegin()>=n){
col=*s.rbegin()-n;
}
else{
col=C[*s.rbegin()];
}
s.erase(*s.rbegin());
if(last[col]==-1){
ans[col]=1;
}
else{
ans[k+last[col]]=1;
}
}
s.insert(nxt[i]);
last[C[i]]=i;
}
f(i,0,n+k) WriteAdvice(ans[i]);
}
#include "assistant.h"
#include <bits/stdc++.h>
using namespace std;
#define dbgv(v) cout<<#v<<" = "; f(i,0,v.size()) cout<<v[i]<<" "; cout<<endl
#define dbga(a,x,y) cout<<#a<<" = "; f(i,x,y) cout<<a[i]<<" "; cout<<endl
#define erorp(x) cout<<#x<<"={"<<x.F<<" , "<<x.S<<"}"<<endl
#define eror(x) cout<<#x<<'='<<(x)<<endl
#define f_(i,a,b) for(int i=a;i>=b;i--)
#define f(i,a,b) for(int i=a;i<b;i++)
#define nb(x) __builtin_popcount(x)
#define all(v) v.begin(),v.end()
#define bit(n,k) (((n)>>(k))&1)
#define Add(x,y) x=(x+y)%mod
#define maxm(a,b) a=max(a,b)
#define minm(a,b) a=min(a,b)
#define lst(x) x[x.size()-1]
#define sz(x) int(x.size())
#define mp make_pair
#define ll long long
#define pb push_back
#define S second
#define F first
const int N=2e5+99;
int mark[N];
void Assist(unsigned char *s, int n, int k, int R) {
vector<int> vec;
f(i,0,k){
mark[i]=1;
if(s[i]=='1') vec.pb(i);
}
f(i,0,n){
int col=GetRequest();
if(s[i+k]=='1'){
vec.pb(col);
}
if(mark[col]==1) continue ;
int x=vec.back();
vec.pop_back();
mark[x]=0;
mark[col]=1;
PutBack(x);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
520 KB |
Error - advice must be 0 or 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
724 KB |
Error - advice must be 0 or 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
9 ms |
1880 KB |
Error - advice must be 0 or 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
660 KB |
Error - advice must be 0 or 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
10 ms |
2112 KB |
Error - advice must be 0 or 1 |
2 |
Incorrect |
9 ms |
2124 KB |
Error - advice must be 0 or 1 |
3 |
Incorrect |
8 ms |
2172 KB |
Error - advice must be 0 or 1 |
4 |
Incorrect |
11 ms |
2072 KB |
Error - advice must be 0 or 1 |
5 |
Incorrect |
9 ms |
2128 KB |
Error - advice must be 0 or 1 |
6 |
Incorrect |
9 ms |
2108 KB |
Error - advice must be 0 or 1 |
7 |
Incorrect |
10 ms |
2084 KB |
Error - advice must be 0 or 1 |
8 |
Incorrect |
8 ms |
2072 KB |
Error - advice must be 0 or 1 |
9 |
Incorrect |
8 ms |
2116 KB |
Error - advice must be 0 or 1 |
10 |
Incorrect |
9 ms |
2076 KB |
Error - advice must be 0 or 1 |