#include "advisor.h"
#include <bits/stdc++.h>
using namespace std;
void ComputeAdvice(int *C, int N, int K, int M) {
int x = *max_element(C,C+N);
for(int i = 0; i < N; i++)
for(int j = 0; j < (x<5000?13:20); j++)
WriteAdvice((C[i]>>j)&1);
}
#include "assistant.h"
#include <bits/stdc++.h>
using namespace std;
void Assist(unsigned char *A, int N, int K, int R) {
int C[N+1]; vector<int> v[N+1];
for(int i = 0; i < N; i++) C[i]=0;
const int bit = R%20?13:20;
for(int i = 0; i < R; i++)
if(A[i]) C[i/bit] |= (1<<(i%bit));
set<int> S; set<pair<int,int>> SS;
for(int i = 0; i < N; i++) v[C[i]].push_back(i);
for(int i = 0; i < N; i++) v[i].push_back(N+1);
for(int i = 0; i < K; i++){
int nx = *upper_bound(begin(v[i]),end(v[i]),-1);
S.insert(i); SS.insert({nx,i});
}
for(int i = 0; i < N; i++) {
int req = GetRequest();
if(S.count(req)){
int nx = *upper_bound(begin(v[req]),end(v[req]),i);
SS.erase({i,req}); SS.insert({nx,req});
continue;
}
int getCol = (--end(SS))->second;
S.erase(getCol); S.insert(req); PutBack(getCol);
int nx = *upper_bound(begin(v[req]),end(v[req]),i);
SS.erase(--end(SS)); SS.insert({nx,req});
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
516 KB |
Output is correct |
2 |
Runtime error |
2 ms |
640 KB |
Execution killed with signal 11 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
36 ms |
2824 KB |
Output is correct |
2 |
Correct |
178 ms |
11252 KB |
Output is correct |
3 |
Correct |
397 ms |
23960 KB |
Output is correct |
4 |
Correct |
333 ms |
20724 KB |
Output is correct |
5 |
Correct |
354 ms |
20856 KB |
Output is correct |
6 |
Correct |
389 ms |
21392 KB |
Output is correct |
7 |
Correct |
382 ms |
22544 KB |
Output is correct |
8 |
Correct |
314 ms |
20000 KB |
Output is correct |
9 |
Correct |
328 ms |
20860 KB |
Output is correct |
10 |
Correct |
382 ms |
23720 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
12 ms |
2332 KB |
Error - advice is too long |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
516 KB |
Error - advice is too long |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
16 ms |
2744 KB |
Error - advice is too long |
2 |
Incorrect |
14 ms |
2692 KB |
Error - advice is too long |
3 |
Incorrect |
14 ms |
2688 KB |
Error - advice is too long |
4 |
Incorrect |
14 ms |
2704 KB |
Error - advice is too long |
5 |
Incorrect |
14 ms |
2644 KB |
Error - advice is too long |
6 |
Incorrect |
15 ms |
2608 KB |
Error - advice is too long |
7 |
Incorrect |
14 ms |
2748 KB |
Error - advice is too long |
8 |
Incorrect |
14 ms |
2764 KB |
Error - advice is too long |
9 |
Incorrect |
16 ms |
2984 KB |
Error - advice is too long |
10 |
Incorrect |
14 ms |
2708 KB |
Error - advice is too long |