#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=131071;
}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<17;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<17;j++) choice+=A[i*17+j]<<j;
if (choice==131071){
}else{
PutBack(pos[choice]);
pos[choice]=nxt;
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
38 ms |
68080 KB |
Output is correct |
2 |
Correct |
41 ms |
68004 KB |
Output is correct |
3 |
Correct |
51 ms |
67976 KB |
Output is correct |
4 |
Correct |
54 ms |
68440 KB |
Output is correct |
5 |
Incorrect |
37 ms |
68076 KB |
Error - advice is too long |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
70 ms |
69452 KB |
Output is correct |
2 |
Correct |
197 ms |
74924 KB |
Output is correct |
3 |
Correct |
419 ms |
81896 KB |
Output is correct |
4 |
Correct |
434 ms |
82588 KB |
Output is correct |
5 |
Correct |
378 ms |
82624 KB |
Output is correct |
6 |
Correct |
407 ms |
82760 KB |
Output is correct |
7 |
Correct |
383 ms |
82952 KB |
Output is correct |
8 |
Correct |
324 ms |
80840 KB |
Output is correct |
9 |
Correct |
350 ms |
82376 KB |
Output is correct |
10 |
Correct |
377 ms |
83340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
323 ms |
79240 KB |
Output is correct |
2 |
Incorrect |
82 ms |
71592 KB |
Error - advice is too long |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
42 ms |
68056 KB |
Error - advice is too long |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
394 ms |
81972 KB |
Output is partially correct - 1700000 bits used |
2 |
Correct |
385 ms |
81856 KB |
Output is partially correct - 1700000 bits used |
3 |
Correct |
382 ms |
81968 KB |
Output is partially correct - 1700000 bits used |
4 |
Correct |
391 ms |
82016 KB |
Output is partially correct - 1700000 bits used |
5 |
Correct |
376 ms |
82004 KB |
Output is partially correct - 1700000 bits used |
6 |
Correct |
375 ms |
82044 KB |
Output is partially correct - 1700000 bits used |
7 |
Correct |
405 ms |
82020 KB |
Output is partially correct - 1697263 bits used |
8 |
Correct |
376 ms |
82144 KB |
Output is partially correct - 1700000 bits used |
9 |
Correct |
405 ms |
82232 KB |
Output is partially correct - 1700000 bits used |
10 |
Correct |
407 ms |
81760 KB |
Output is partially correct - 1700000 bits used |