#include<bits/stdc++.h>
#include "advisor.h"
using namespace std;
void ComputeAdvice(int *c, int n, int k, int m) {
vector<int> br(n);
for(int i = 0; i < n; i++) {
br[c[i]]++;
}
for(int i = 0; i < n; i++) {
for(int j = 0; j < br[i]; i++) {
WriteAdvice(1);
}
WriteAdvice(0);
}
}
#include<bits/stdc++.h>
#include "assistant.h"
using namespace std;
void Assist(unsigned char *a, int n, int k, int r) {
vector<int> br(n);
int y = 0,b,sm = 0,p;
for(int i = 0; i < r; i++) {
if((int)a[i] == 0) {
y++;
}
else {
br[y]++;
}
}
vector<bool> bruh(n);
vector<bool> prot(n);
for(int i = 0; i < k; i++) {
bruh[i] = true;
}
for(int i = 0; i < n; i++) {
b = GetRequest();
if(!bruh[b]) {
p = -1;
sm = INT_MAX;
for(int j = 0; j < n; j++) {
if(bruh[j] == true && prot[j] == false && br[j] < sm) {
sm = br[j];
p = j;
}
}
PutBack(p);
bruh[p] = false;
for(int j = 0; j < n; j++) {
if(bruh[j] && br[j] > 1) {
prot[j] = true;
}
}
bruh[b] = true;
}
else {
prot[b] = false;
}
br[b]--;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
512 KB |
Output isn't correct - not an optimal way |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
233 ms |
984 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 |
2601 ms |
3976 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
30 ms |
780 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 |
2594 ms |
4748 KB |
Time limit exceeded |
2 |
Execution timed out |
2505 ms |
4804 KB |
Time limit exceeded |
3 |
Execution timed out |
2587 ms |
4804 KB |
Time limit exceeded |
4 |
Execution timed out |
2590 ms |
4800 KB |
Time limit exceeded |
5 |
Execution timed out |
2589 ms |
4768 KB |
Time limit exceeded |
6 |
Execution timed out |
2561 ms |
4712 KB |
Time limit exceeded |
7 |
Execution timed out |
2589 ms |
4800 KB |
Time limit exceeded |
8 |
Execution timed out |
2578 ms |
4808 KB |
Time limit exceeded |
9 |
Execution timed out |
2545 ms |
4648 KB |
Time limit exceeded |
10 |
Execution timed out |
2587 ms |
4748 KB |
Time limit exceeded |