#include "advisor.h"
#include <bits/stdc++.h>
using namespace std;
vector <int> pos[100001];
int a[125001],b[100001],c[100001];
set <pair <int, int>> s;
void ComputeAdvice(int *C, int N, int K, int M){
for (int i=0;i<N;i++)
pos[i].push_back(1000000);
for (int i=N-1;i>=0;i--)
pos[C[i]].push_back(i+K);
for (int i=0;i<K;i++){
b[i]=i;
c[i]=1;
s.insert({pos[i].back(),i});
pos[i].pop_back();
}
for (int i=0;i<N;i++){
if (c[C[i]]){
a[b[C[i]]]=1;
b[C[i]]=i;
continue;
}
b[C[i]]=i+K;
auto [x,y]=*--s.end();
s.erase(--s.end());
c[C[i]]=1;
c[y]=0;
s.insert({pos[C[i]].back(),C[i]});
pos[C[i]].pop_back();
}
for (auto [x,y]:s)
a[b[y]]=1;
for (int i=0;i<N+K;i++)
WriteAdvice(a[i]);
}
#include "assistant.h"
#include <bits/stdc++.h>
using namespace std;
int ch[100001];
void Assist(unsigned char *A, int N, int K, int R){
vector <int> ve;
for (int i=0;i<K;i++){
if (!A[i+1])
ve.push_back(i);
ch[i]=1;
}
for (int i=0;i<N;i++){
int c=GetRequest();
if (!ch[c]){
PutBack(ve.back());
ch[ve.back()]=0;
ch[c]=1;
ve.pop_back();
}
if (!A[i+K+1])
ve.push_back(c);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
4124 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 |
Incorrect |
7 ms |
4960 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 |
Incorrect |
47 ms |
10424 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 |
Incorrect |
4 ms |
4404 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 |
Incorrect |
57 ms |
11592 KB |
Error - Putting back a color that is not on the scaffold |
2 |
Incorrect |
73 ms |
11824 KB |
Error - Putting back a color that is not on the scaffold |
3 |
Incorrect |
68 ms |
12056 KB |
Error - Putting back a color that is not on the scaffold |
4 |
Incorrect |
72 ms |
11788 KB |
Error - Putting back a color that is not on the scaffold |
5 |
Incorrect |
59 ms |
11868 KB |
Error - Putting back a color that is not on the scaffold |
6 |
Incorrect |
77 ms |
11772 KB |
Error - Putting back a color that is not on the scaffold |
7 |
Incorrect |
63 ms |
11832 KB |
Error - Putting back a color that is not on the scaffold |
8 |
Incorrect |
65 ms |
12284 KB |
Error - Putting back a color that is not on the scaffold |
9 |
Incorrect |
87 ms |
11824 KB |
Error - Putting back a color that is not on the scaffold |
10 |
Incorrect |
76 ms |
11948 KB |
Error - Putting back a color that is not on the scaffold |