#include "advisor.h"
#include<bits/stdc++.h>
using namespace std;
int c[100050],curr[100050];
deque<int> ap[100050];
priority_queue<pair<int,int>> pq;
void ComputeAdvice(int *C, int n, int k, int m) {
for (int i=0;i<n;i++) c[i]=C[i];
for (int i=0;i<n;i++) ap[c[i]].push_back(i);
for (int i=0;i<n;i++) ap[i].push_back(2e9);
for (int i=0;i<k;i++) curr[i]=i,pq.push({ap[i][0],i});
for (int i=k;i<n;i++) curr[i]=-1;
for (int i=0;i<n;i++){
int choice;
if (curr[c[i]]!=-1){
choice=32767;
}else{
choice=curr[c[i]]=curr[pq.top().second];
curr[pq.top().second]=-1;
pq.pop();
}
while (ap[c[i]].front()<=i) ap[c[i]].pop_front();
pq.push({ap[c[i]].front(),c[i]});
for (int j=0;j<13;j++) WriteAdvice((choice>>j)&1);
}
}
#include "assistant.h"
#include<bits/stdc++.h>
int pos[100050];
void Assist(unsigned char *A, int n, int k, int R) {
for (int i=0;i<k;i++) pos[i]=i;
for (int i=k;i<n;i++) pos[i]=-1;
for (int i=0;i<n;i++){
int nxt=GetRequest();
int choice=0;
for (int j=0;j<13;j++) choice+=A[i*13+j]<<j;
if (choice==32767){
}else{
PutBack(pos[choice]);
pos[choice]=nxt;
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
40 ms |
67952 KB |
Error - Putting back a color when it is already on the scaffold |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
65 ms |
69056 KB |
Error - Putting back a color when it is already on the scaffold |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
272 ms |
77320 KB |
Error - Putting back a color when it is already on the scaffold |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
40 ms |
68120 KB |
Error - advice is too long |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
351 ms |
79640 KB |
Error - Putting back a color when it is already on the scaffold |
2 |
Incorrect |
322 ms |
79524 KB |
Error - Putting back a color when it is already on the scaffold |
3 |
Incorrect |
332 ms |
79532 KB |
Error - Putting back a color when it is already on the scaffold |
4 |
Incorrect |
340 ms |
79496 KB |
Error - Putting back a color when it is already on the scaffold |
5 |
Incorrect |
325 ms |
79584 KB |
Error - Putting back a color when it is already on the scaffold |
6 |
Incorrect |
340 ms |
79756 KB |
Error - Putting back a color when it is already on the scaffold |
7 |
Incorrect |
319 ms |
79564 KB |
Error - Putting back a color when it is already on the scaffold |
8 |
Incorrect |
330 ms |
79576 KB |
Error - Putting back a color when it is already on the scaffold |
9 |
Incorrect |
320 ms |
79568 KB |
Error - Putting back a color when it is already on the scaffold |
10 |
Incorrect |
317 ms |
79308 KB |
Error - Putting back a color when it is already on the scaffold |