#include "advisor.h"
const int LG = 13;
void ComputeAdvice(int *C, int N, int K, int M) {
for (int i = 0; i < N; i++) {
for (int j = 0; j < LG; j++) {
WriteAdvice(C[i] >> j & 1);
}
}
}
#include "assistant.h"
const int maxn = 100025;
const int LG = 13;
int C[maxn];
int last[maxn];
int scaffold[maxn];
bool onScaffold[maxn];
void Assist(unsigned char *A, int N, int K, int R) {
for (int i = 0; i < N; i++) {
for (int j = 0; j < LG; j++) {
C[i] |= A[i*LG + j] * (1<<j);
}
}
for (int i = 0; i < K; i++)
scaffold[i] = i;
for (int i = 0; i < N; i++) {
int req = GetRequest();
if (!onScaffold[req]) {
for (int i = 0; i < N; i++) last[i] = maxn;
for (int j = N-1; j > i; j--)
last[C[j]] = j;
int pos = -1;
for (int j = 0; j < K; j++)
if(pos == -1 || last[scaffold[pos]] < last[scaffold[j]])
pos = j;
onScaffold[req] = true;
onScaffold[scaffold[pos]] = false;
PutBack(scaffold[pos]);
scaffold[pos] = req;
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
760 KB |
Error - Putting back a color when it is already on the scaffold |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
34 ms |
1704 KB |
Error - Putting back a color when it is already on the scaffold |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
275 ms |
9364 KB |
Error - Putting back a color when it is already on the scaffold |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
972 KB |
Error - advice is too long |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
346 ms |
11476 KB |
Error - Putting back a color when it is already on the scaffold |
2 |
Incorrect |
337 ms |
11736 KB |
Error - Putting back a color when it is already on the scaffold |
3 |
Incorrect |
319 ms |
11472 KB |
Error - Putting back a color when it is already on the scaffold |
4 |
Incorrect |
365 ms |
11500 KB |
Error - Putting back a color when it is already on the scaffold |
5 |
Incorrect |
327 ms |
11748 KB |
Error - Putting back a color when it is already on the scaffold |
6 |
Incorrect |
336 ms |
11628 KB |
Error - Putting back a color when it is already on the scaffold |
7 |
Incorrect |
356 ms |
11368 KB |
Error - Putting back a color when it is already on the scaffold |
8 |
Incorrect |
323 ms |
11748 KB |
Error - Putting back a color when it is already on the scaffold |
9 |
Incorrect |
321 ms |
11604 KB |
Error - Putting back a color when it is already on the scaffold |
10 |
Incorrect |
320 ms |
11688 KB |
Error - Putting back a color when it is already on the scaffold |