#include "advisor.h"
#include <bits/stdc++.h>
#pragma GCC optimize ("O2,unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl;
#define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl;
#define debugv(v) {cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;}
#define all(x) x.begin(), x.end()
#define pb push_back
#define kill(x) return cout<<x<<'\n', 0;
const int inf=1000000010;
const ll INF=1000000000000001000LL;
const int mod=1000000007;
const int MAXN=300010, LOG=20;
int nex[MAXN], last[MAXN];
void ComputeAdvice(int *C, int N, int K, int M){
for (int i=0; i<N; i++) last[i]=N;
for (int i=N-1; ~i; i--){
nex[i]=last[C[i]];
last[C[i]]=i;
}
for (int i=0; i<K; i++) WriteAdvice(last[i]<N);
for (int i=0; i<N; i++) WriteAdvice(nex[i]<N);
}
#include "assistant.h"
#include <bits/stdc++.h>
#pragma GCC optimize ("O2,unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl;
#define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl;
#define debugv(v) {cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;}
#define all(x) x.begin(), x.end()
#define pb push_back
#define kill(x) return cout<<x<<'\n', 0;
const int inf=1000000010;
const ll INF=1000000000000001000LL;
const int mod=1000000007;
const int MAXN=300010, LOG=20;
bool A[MAXN], B[MAXN];
void Assist(unsigned char *AA, int N, int K, int R){
for (int i=0; i<K; i++) A[i]=AA[i], B[i]=1;
for (int i=K; i<N+K; i++){
int col=GetRequest();
A[col]=AA[i];
if (!B[col]){
bool ok=0;
for (int j=0; j<N; j++) if (B[j] && !A[j]){
PutBack(j);
B[j]=0;
ok=1;
}
if (!ok){
for (int j=0; j<N; j++) if (B[j]){
PutBack(j);
B[j]=0;
ok=1;
}
}
assert(ok);
B[col]=1;
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
740 KB |
Output is correct |
2 |
Incorrect |
2 ms |
868 KB |
Error - Putting back a color again without request |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
1088 KB |
Error - Putting back a color again without request |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
55 ms |
3732 KB |
Error - Putting back a color again without request |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
860 KB |
Error - Putting back a color again without request |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
64 ms |
4276 KB |
Error - Putting back a color again without request |
2 |
Incorrect |
64 ms |
4788 KB |
Error - Putting back a color again without request |
3 |
Incorrect |
74 ms |
4540 KB |
Error - Putting back a color again without request |
4 |
Incorrect |
71 ms |
4540 KB |
Error - Putting back a color again without request |
5 |
Incorrect |
66 ms |
4412 KB |
Error - Putting back a color again without request |
6 |
Incorrect |
65 ms |
4784 KB |
Error - Putting back a color again without request |
7 |
Incorrect |
65 ms |
4540 KB |
Error - Putting back a color again without request |
8 |
Incorrect |
64 ms |
4784 KB |
Error - Putting back a color again without request |
9 |
Incorrect |
64 ms |
4656 KB |
Error - Putting back a color again without request |
10 |
Incorrect |
79 ms |
4540 KB |
Error - Putting back a color again without request |