#include <bits/stdc++.h>
#ifndef ARTHUR_LOCAL
#include "advisor.h"
#endif
using namespace std;
void ComputeAdvice(int *C, int n, int k, int m)
{
for(int i=0; i<n; i++)
{
for(int b=0; b<13; b++)
{
if(1<<b & C[i]) WriteAdvice(1);
else WriteAdvice(0);
}
}
}
// int main()
// {
// #ifdef ARTHUR_LOCAL
// ifstream cin("input.txt");
// #endif
// }
#include <bits/stdc++.h>
#ifndef ARTHUR_LOCAL
#include "assistant.h"
#endif
using namespace std;
const int INF = 1000000000;
void Assist(unsigned char *A, int n, int k, int r)
{
vector<int> C;
for(int i=0; i<n; i++)
{
int cur=0;
for(int b=0; b<13; b++)
{
if(A[i*13 + b]) cur += 1<<b;
}
C.push_back(cur);
}
// now we actually have to use the optimal strat ...
vector<bool> on_scaff(n+1);
for(int i=0; i<k; i++) on_scaff[i]=1;
priority_queue<pair<int,int>> scaff;
vector<int> next_col_occ(n+1,INF);
vector<int> next_occ(n+1,INF);
for(int i=n-1; i>=0; i--)
{
if(i<k) scaff.push({next_col_occ[C[i]],C[i]});
next_occ[i]=next_col_occ[C[i]];
next_col_occ[C[i]]=i;
}
int ans=0;
for(int i=0; i<n; i++)
{
int do_nothing = GetRequest();
if(on_scaff[C[i]]) continue;
else
{
ans++;
PutBack(scaff.top().second);
on_scaff[scaff.top().second]=0;
scaff.pop();
on_scaff[C[i]]=1;
scaff.push({next_occ[i],C[i]});
}
}
}
Compilation message
assistant.cpp: In function 'void Assist(unsigned char*, int, int, int)':
assistant.cpp:49:7: warning: unused variable 'do_nothing' [-Wunused-variable]
int do_nothing = GetRequest();
^~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
892 KB |
Error - Putting back a color that is not on the scaffold |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
33 ms |
1964 KB |
Error - Putting back a color that is not on the scaffold |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
244 ms |
9864 KB |
Error - Not putting back color when it is not on the scaffold |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
880 KB |
Error - advice is too long |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
308 ms |
12200 KB |
Error - Not putting back color when it is not on the scaffold |
2 |
Incorrect |
308 ms |
12004 KB |
Error - Not putting back color when it is not on the scaffold |
3 |
Incorrect |
303 ms |
12348 KB |
Error - Not putting back color when it is not on the scaffold |
4 |
Incorrect |
302 ms |
12404 KB |
Error - Not putting back color when it is not on the scaffold |
5 |
Incorrect |
302 ms |
12208 KB |
Error - Not putting back color when it is not on the scaffold |
6 |
Incorrect |
303 ms |
12412 KB |
Error - Not putting back color when it is not on the scaffold |
7 |
Incorrect |
306 ms |
12316 KB |
Error - Not putting back color when it is not on the scaffold |
8 |
Incorrect |
303 ms |
12192 KB |
Error - Not putting back color when it is not on the scaffold |
9 |
Incorrect |
304 ms |
12264 KB |
Error - Not putting back color when it is not on the scaffold |
10 |
Incorrect |
308 ms |
12332 KB |
Error - Not putting back color when it is not on the scaffold |