#include "advisor.h"
#include <bits/stdc++.h>
using namespace std;
const int N_BITS = 13;
void ComputeAdvice(int *C, int N, int K, int M) {
for (int iVal = 0; iVal < N; ++iVal){
int val = C[iVal];
for (int i = 0; i < N_BITS; ++i)
WriteAdvice((val&(1 << i)) > 0);
}
}
#include "assistant.h"
#include <bits/stdc++.h>
using namespace std;
const int N_BITS = 13;
void Assist(unsigned char *A, int N, int K, int R) {
vector<int> C;
for (int i = 0; i < R; i += N_BITS){
int tot = 0;
for (int bit = 0; bit < N_BITS; ++bit)
tot += A[i + bit] * (1 << bit);
C.push_back(tot);
}
set<int> presents, absents;
for (int i = 0; i < K; ++i)
presents.insert(i);
for (int i = K; i < N; ++i)
absents.insert(i);
for (int iReq = 0; iReq < N; ++iReq){
int proc = GetRequest();
if (presents.count(proc) == 0){
presents.insert(proc);
absents.erase(proc);
int procUtil = -1, color = -1;
for (int present : presents){
int ind = iReq + 1;
while (ind < N && C[ind] != present)
++ind;
if (ind > procUtil){
procUtil = ind;
color = present;
}
}
PutBack(color);
presents.erase(color);
absents.insert(color);
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
496 KB |
Output is correct |
2 |
Incorrect |
2 ms |
484 KB |
Error - Putting back a color that is not on the scaffold |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1472 ms |
2052 KB |
Error - Putting back a color that is not on the scaffold |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2584 ms |
12404 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
496 KB |
Error - advice is too long |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2519 ms |
15380 KB |
Time limit exceeded |
2 |
Execution timed out |
2595 ms |
15472 KB |
Time limit exceeded |
3 |
Execution timed out |
2527 ms |
15632 KB |
Time limit exceeded |
4 |
Execution timed out |
2598 ms |
15384 KB |
Time limit exceeded |
5 |
Execution timed out |
2602 ms |
15524 KB |
Time limit exceeded |
6 |
Execution timed out |
2521 ms |
15384 KB |
Time limit exceeded |
7 |
Execution timed out |
2514 ms |
15268 KB |
Time limit exceeded |
8 |
Execution timed out |
2529 ms |
15372 KB |
Time limit exceeded |
9 |
Execution timed out |
2524 ms |
15388 KB |
Time limit exceeded |
10 |
Execution timed out |
2517 ms |
15400 KB |
Time limit exceeded |