#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,now;
int last = 0;
for(int i = 0;i<k;i++){
if(a[last++] == 1){
s.insert(i);
}
now.insert(i);
}
for (int i = 0; i < n; i++) {
int req = GetRequest();
if(now.count(req) == 0){
int num = *now.begin();
if(s.size()){
num = *s.begin();
s.erase(s.begin());
}
now.erase(num);
PutBack(num);
now.insert(req);
}
if(a[last++] == 1){
s.insert(req);
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
520 KB |
Output is correct |
2 |
Correct |
1 ms |
520 KB |
Output is correct |
3 |
Correct |
2 ms |
780 KB |
Output is correct |
4 |
Incorrect |
3 ms |
668 KB |
Output isn't correct - not an optimal way |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
11 ms |
1528 KB |
Output isn't correct - not an optimal way |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
100 ms |
8900 KB |
Output is correct |
2 |
Correct |
104 ms |
10880 KB |
Output is correct |
3 |
Correct |
103 ms |
11264 KB |
Output is correct |
4 |
Correct |
110 ms |
10940 KB |
Output is correct |
5 |
Incorrect |
97 ms |
10032 KB |
Output isn't correct - not an optimal way |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
948 KB |
Output is correct |
2 |
Correct |
4 ms |
1076 KB |
Output is correct |
3 |
Incorrect |
3 ms |
924 KB |
Output isn't correct - not an optimal way |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
105 ms |
10612 KB |
Output isn't correct - not an optimal way |
2 |
Correct |
108 ms |
10936 KB |
Output is correct - 122000 bits used |
3 |
Correct |
103 ms |
11068 KB |
Output is correct - 125000 bits used |
4 |
Correct |
109 ms |
11104 KB |
Output is correct - 125000 bits used |
5 |
Correct |
105 ms |
11108 KB |
Output is correct - 125000 bits used |
6 |
Correct |
110 ms |
11084 KB |
Output is correct - 125000 bits used |
7 |
Correct |
105 ms |
11168 KB |
Output is correct - 124828 bits used |
8 |
Correct |
105 ms |
11068 KB |
Output is correct - 124910 bits used |
9 |
Correct |
122 ms |
11088 KB |
Output is correct - 125000 bits used |
10 |
Incorrect |
103 ms |
12104 KB |
Output isn't correct - not an optimal way |