#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<15;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<15;j++) choice+=A[i*15+j]<<j;
if (choice==32767){
}else{
PutBack(pos[choice]);
pos[choice]=nxt;
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
39 ms |
67812 KB |
Output is correct |
2 |
Correct |
40 ms |
67884 KB |
Output is correct |
3 |
Correct |
43 ms |
68176 KB |
Output is correct |
4 |
Correct |
52 ms |
68520 KB |
Output is correct |
5 |
Incorrect |
40 ms |
68236 KB |
Error - advice is too long |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
68 ms |
69184 KB |
Output is correct |
2 |
Correct |
212 ms |
75320 KB |
Output is correct |
3 |
Incorrect |
366 ms |
81900 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 |
Correct |
315 ms |
78416 KB |
Output is correct |
2 |
Correct |
360 ms |
81960 KB |
Output is correct |
3 |
Correct |
357 ms |
81936 KB |
Output is correct |
4 |
Correct |
382 ms |
82064 KB |
Output is correct |
5 |
Correct |
386 ms |
81908 KB |
Output is correct |
6 |
Correct |
341 ms |
81912 KB |
Output is correct |
7 |
Correct |
345 ms |
81960 KB |
Output is correct |
8 |
Correct |
383 ms |
81796 KB |
Output is correct |
9 |
Correct |
373 ms |
82176 KB |
Output is correct |
10 |
Correct |
343 ms |
82036 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
47 ms |
68140 KB |
Error - advice is too long |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
359 ms |
80760 KB |
Output is partially correct - 1500000 bits used |
2 |
Correct |
365 ms |
80784 KB |
Output is partially correct - 1500000 bits used |
3 |
Correct |
410 ms |
80900 KB |
Output is partially correct - 1500000 bits used |
4 |
Correct |
350 ms |
80784 KB |
Output is partially correct - 1500000 bits used |
5 |
Correct |
350 ms |
80816 KB |
Output is partially correct - 1500000 bits used |
6 |
Correct |
353 ms |
80868 KB |
Output is partially correct - 1500000 bits used |
7 |
Correct |
347 ms |
80720 KB |
Output is partially correct - 1497585 bits used |
8 |
Correct |
355 ms |
80880 KB |
Output is partially correct - 1500000 bits used |
9 |
Correct |
376 ms |
80972 KB |
Output is partially correct - 1500000 bits used |
10 |
Correct |
354 ms |
80576 KB |
Output is partially correct - 1500000 bits used |