#include <bits/stdc++.h>
#include "advisor.h"
using namespace std;
void ComputeAdvice(int *C, int N, int K, int M) {
for (int i=0;i<N;i++){
int x = C[i];
for (int j = 19; j >= 0; j--){
if (((x >> j) & 1)) WriteAdvice(1);
else WriteAdvice(0);
}
}
}
#include <bits/stdc++.h>
#include "assistant.h"
using namespace std;
const int MM = 2e6 + 5;
int CC[MM];
bool on[MM];
set <int> st[MM];
void Assist(unsigned char *A, int N, int K, int R) {
int id=0;
for (int i = 0; i < R; i += 20){
for (int j = i; j <= i + 19; j++){
if (A[j] == 1) CC[id] |= (1<<(19-(j-i)));
}
id+=1;
}
/*
cout<<"Here"<<endl;
for (int i=0;i<id;i++)
cout<<CC[i]<<" ";
cout<<endl;*/
for (int i=id-1;i>=0;i--){
st[CC[i]].insert(i);
}
for (int i=0;i<K;i++)
on[i]=1;
int i;
for (i = 0; i < N; i++) {
int req = GetRequest();
if (on[req]) continue;
int mx=-1,idx=-1;
for (int j=0;j<N;j++){
if (!on[j]) continue;
while (st[j].size() && *st[j].begin() < i){
st[j].erase(st[j].begin());
}
if (!st[j].size()){
idx=j;
break;
}
int y = *st[j].begin();
if (y > mx){
mx = y;
idx = j;
}
}
PutBack(idx);
on[idx] = 0;
on[req] = 1;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
27 ms |
94648 KB |
Output is correct |
2 |
Correct |
30 ms |
94732 KB |
Output is correct |
3 |
Correct |
44 ms |
94756 KB |
Output is correct |
4 |
Correct |
47 ms |
95376 KB |
Output is correct |
5 |
Incorrect |
40 ms |
94648 KB |
Error - advice is too long |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
77 ms |
96684 KB |
Output is correct |
2 |
Correct |
1144 ms |
104828 KB |
Output is correct |
3 |
Execution timed out |
2588 ms |
114924 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
40 ms |
96460 KB |
Error - advice is too long |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
29 ms |
94604 KB |
Error - advice is too long |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
43 ms |
96872 KB |
Error - advice is too long |
2 |
Incorrect |
44 ms |
96700 KB |
Error - advice is too long |
3 |
Incorrect |
50 ms |
96688 KB |
Error - advice is too long |
4 |
Incorrect |
45 ms |
96724 KB |
Error - advice is too long |
5 |
Incorrect |
43 ms |
96788 KB |
Error - advice is too long |
6 |
Incorrect |
47 ms |
96800 KB |
Error - advice is too long |
7 |
Incorrect |
45 ms |
96760 KB |
Error - advice is too long |
8 |
Incorrect |
46 ms |
96708 KB |
Error - advice is too long |
9 |
Incorrect |
44 ms |
96744 KB |
Error - advice is too long |
10 |
Incorrect |
46 ms |
96776 KB |
Error - advice is too long |