#include "advisor.h"
#include <bits/stdc++.h>
using namespace std;
void ComputeAdvice(int *c, int n, int k, int m){
vector<int> occ[n];
for(int i = n-1;i>=0;i--){
occ[c[i]].push_back(i);
}
for(int i = 0;i<k;i++){
WriteAdvice(occ[i].empty());
}
for(int i = 0;i<n;i++){
occ[c[i]].pop_back();
WriteAdvice(occ[c[i]].empty());
}
}
#include "assistant.h"
#include <bits/stdc++.h>
using namespace std;
void Assist(unsigned char *a, int n, int k, int r) {
set<int> s;
int last = 0;
bool now[n];
for(int i = 0;i<n;i++){
now[i] = 0;
}
for(int i = 0;i<k;i++){
if(a[last++] == 1){
s.insert(i);
}
now[i] = 1;
}
return;
for (int i = 0; i < n; i++) {
int req = GetRequest();
if(now[req] == 0){
now[*s.begin()] = 0;
PutBack(*s.begin());
s.erase(s.begin());
now[req] = 1;
}
if(a[last++] == 1){
s.insert(req);
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
516 KB |
Error - GetRequest() must be called N times |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
6 ms |
1364 KB |
Error - GetRequest() must be called N times |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
49 ms |
6760 KB |
Error - GetRequest() must be called N times |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
932 KB |
Error - GetRequest() must be called N times |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
56 ms |
7996 KB |
Error - GetRequest() must be called N times |
2 |
Incorrect |
62 ms |
8076 KB |
Error - GetRequest() must be called N times |
3 |
Incorrect |
62 ms |
8180 KB |
Error - GetRequest() must be called N times |
4 |
Incorrect |
62 ms |
8236 KB |
Error - GetRequest() must be called N times |
5 |
Incorrect |
60 ms |
8232 KB |
Error - GetRequest() must be called N times |
6 |
Incorrect |
57 ms |
8148 KB |
Error - GetRequest() must be called N times |
7 |
Incorrect |
59 ms |
8176 KB |
Error - GetRequest() must be called N times |
8 |
Incorrect |
61 ms |
8156 KB |
Error - GetRequest() must be called N times |
9 |
Incorrect |
60 ms |
8256 KB |
Error - GetRequest() must be called N times |
10 |
Incorrect |
62 ms |
8828 KB |
Error - GetRequest() must be called N times |