#include "advisor.h"
#include <vector>
void ComputeAdvice(int *C, int N, int K, int M) {
std::vector < int > viz(N, 0);
int timp = 0;
for (int i = 0; i < K; i++) {
int pos = 0, cnt = 0;
timp++;
while (pos < N && C[pos] != i) {
cnt += viz[C[pos]] != timp;
viz[C[pos]] = timp;
pos++;
}
WriteAdvice(pos < N && cnt < K);
}
for (int i = 0; i < N; i++) {
int pos = i + 1, cnt = 0;
timp++;
while (pos < N && C[pos] != i) {
cnt += viz[C[pos]] != timp;
viz[C[pos]] = timp;
pos++;
}
WriteAdvice(pos < N && cnt < K);
}
}
#include "assistant.h"
#include <vector>
void Assist(unsigned char *A, int N, int K, int R) {
std::vector < int > v(K), t(N, 0);
for (int i = 0; i < K; i++)
v[i] = i, t[i] = A[i];
for (int i = 0; i < N; i++) {
int x = GetRequest();
int p = 0;
while (p < K && v[p] != x)
p++;
if (p >= K) {
p = 0;
while (t[v[p]])
p++;
PutBack(v[p]);
}
t[x] = A[i + K];
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
640 KB |
Output is correct |
2 |
Incorrect |
4 ms |
904 KB |
Error - Putting back a color that is not on the scaffold |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
84 ms |
1008 KB |
Error - Putting back a color that is not on the scaffold |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2527 ms |
1588 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
20 ms |
1072 KB |
Error - Putting back a color that is not on the scaffold |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2523 ms |
1848 KB |
Time limit exceeded |
2 |
Execution timed out |
2515 ms |
1876 KB |
Time limit exceeded |
3 |
Execution timed out |
2549 ms |
1784 KB |
Time limit exceeded |
4 |
Execution timed out |
2531 ms |
1912 KB |
Time limit exceeded |
5 |
Execution timed out |
2541 ms |
1912 KB |
Time limit exceeded |
6 |
Execution timed out |
2546 ms |
1784 KB |
Time limit exceeded |
7 |
Execution timed out |
2547 ms |
1840 KB |
Time limit exceeded |
8 |
Execution timed out |
2546 ms |
1788 KB |
Time limit exceeded |
9 |
Execution timed out |
2559 ms |
1756 KB |
Time limit exceeded |
10 |
Execution timed out |
2559 ms |
1784 KB |
Time limit exceeded |