#include "advisor.h"
#include <iostream>
using std::cerr;
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);
}
}
// cerr << "C = ";
// for (int i = 0; i < N; i++)
// cerr << C[i] << ' ';
// cerr << '\n';
}
#include "assistant.h"
#include <iostream>
using std::cerr;
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);
}
}
// cerr << "C = ";
// for (int i = 0; i < N; i++)
// cerr << C[i] << ' ';
// cerr << '\n';
for (int i = 0; i < K; i++)
scaffold[i] = i, onScaffold[i] = true;
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;
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
980 KB |
Output is correct |
2 |
Correct |
2 ms |
868 KB |
Output is correct |
3 |
Correct |
4 ms |
816 KB |
Output is correct |
4 |
Correct |
24 ms |
1232 KB |
Output is correct |
5 |
Correct |
68 ms |
1412 KB |
Output is correct |
6 |
Correct |
63 ms |
1428 KB |
Output is correct |
7 |
Correct |
25 ms |
1428 KB |
Output is correct |
8 |
Correct |
80 ms |
1668 KB |
Output is correct |
9 |
Correct |
73 ms |
1428 KB |
Output is correct |
10 |
Correct |
61 ms |
1588 KB |
Output is correct |
11 |
Correct |
61 ms |
1428 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
223 ms |
1832 KB |
Output isn't correct - not an optimal way |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2569 ms |
9596 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
1008 KB |
Error - advice is too long |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2597 ms |
11608 KB |
Time limit exceeded |
2 |
Execution timed out |
2508 ms |
11744 KB |
Time limit exceeded |
3 |
Execution timed out |
2526 ms |
11732 KB |
Time limit exceeded |
4 |
Execution timed out |
2546 ms |
11732 KB |
Time limit exceeded |
5 |
Execution timed out |
2510 ms |
11616 KB |
Time limit exceeded |
6 |
Execution timed out |
2526 ms |
11732 KB |
Time limit exceeded |
7 |
Execution timed out |
2535 ms |
11792 KB |
Time limit exceeded |
8 |
Execution timed out |
2514 ms |
11732 KB |
Time limit exceeded |
9 |
Execution timed out |
2601 ms |
11748 KB |
Time limit exceeded |
10 |
Execution timed out |
2513 ms |
11760 KB |
Time limit exceeded |