#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=8191;
}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==8191){
}else{
PutBack(pos[choice]);
pos[choice]=nxt;
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
40 ms |
67900 KB |
Output is correct |
2 |
Correct |
37 ms |
67788 KB |
Output is correct |
3 |
Correct |
40 ms |
68108 KB |
Output is correct |
4 |
Correct |
47 ms |
68444 KB |
Output is correct |
5 |
Correct |
48 ms |
68624 KB |
Output is correct |
6 |
Correct |
58 ms |
68452 KB |
Output is correct |
7 |
Correct |
59 ms |
68460 KB |
Output is correct |
8 |
Correct |
52 ms |
68448 KB |
Output is correct |
9 |
Correct |
53 ms |
68704 KB |
Output is correct |
10 |
Correct |
51 ms |
68760 KB |
Output is correct |
11 |
Correct |
52 ms |
68448 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
72 ms |
69148 KB |
Output is correct |
2 |
Correct |
167 ms |
73812 KB |
Output is correct |
3 |
Incorrect |
310 ms |
79584 KB |
Error - Not putting back color when it is not on the scaffold |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
284 ms |
77324 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 |
39 ms |
67880 KB |
Error - advice is too long |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
326 ms |
79544 KB |
Error - Not putting back color when it is not on the scaffold |
2 |
Incorrect |
312 ms |
79512 KB |
Error - Not putting back color when it is not on the scaffold |
3 |
Incorrect |
327 ms |
79584 KB |
Error - Not putting back color when it is not on the scaffold |
4 |
Incorrect |
309 ms |
79604 KB |
Error - Not putting back color when it is not on the scaffold |
5 |
Incorrect |
304 ms |
79620 KB |
Error - Not putting back color when it is not on the scaffold |
6 |
Incorrect |
326 ms |
79524 KB |
Error - Not putting back color when it is not on the scaffold |
7 |
Incorrect |
306 ms |
79800 KB |
Error - Not putting back color when it is not on the scaffold |
8 |
Incorrect |
356 ms |
79636 KB |
Error - Not putting back color when it is not on the scaffold |
9 |
Incorrect |
337 ms |
79744 KB |
Error - Not putting back color when it is not on the scaffold |
10 |
Incorrect |
309 ms |
79336 KB |
Error - Not putting back color when it is not on the scaffold |