#include <bits/stdc++.h>
#include "advisor.h"
using namespace std;
void ComputeAdvice(int *C, int N, int K, int M) {
for (int i=0;i<N;i++){
int x = C[i];
for (int j = 12; j >= 0; j--){
if (((x >> j) & 1)) WriteAdvice(1);
else WriteAdvice(0);
}
}
}
#include <bits/stdc++.h>
#include "assistant.h"
using namespace std;
const int MM = 2e6 + 5;
int CC[MM];
bool on[MM];
set <int> st[MM];
void Assist(unsigned char *A, int N, int K, int R) {
int id=0;
for (int i = 0; i < R; i += 13){
for (int j = i; j <= i + 12; j++){
if (A[j] == 1) CC[id] |= (1<<(12-(j-i)));
}
id+=1;
}
/*
cout<<"Here"<<endl;
for (int i=0;i<id;i++)
cout<<CC[i]<<" ";
cout<<endl;*/
for (int i=id-1;i>=0;i--){
st[CC[i]].insert(i);
}
for (int i=0;i<K;i++)
on[i]=1;
int i;
for (i = 0; i < N; i++) {
int req = GetRequest();
if (on[req]) continue;
int mx=-1,idx=-1;
for (int j=0;j<N;j++){
if (!on[j]) continue;
while (st[j].size() && *st[j].begin() < i){
st[j].erase(st[j].begin());
}
if (!st[j].size()){
idx=j;
break;
}
int y = *st[j].begin();
if (y > mx){
mx = y;
idx = j;
}
}
PutBack(idx);
on[idx] = 0;
on[req] = 1;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
29 ms |
94744 KB |
Output is correct |
2 |
Correct |
29 ms |
94696 KB |
Output is correct |
3 |
Correct |
31 ms |
94740 KB |
Output is correct |
4 |
Correct |
44 ms |
95056 KB |
Output is correct |
5 |
Correct |
48 ms |
95484 KB |
Output is correct |
6 |
Correct |
47 ms |
95444 KB |
Output is correct |
7 |
Correct |
39 ms |
95424 KB |
Output is correct |
8 |
Correct |
44 ms |
95396 KB |
Output is correct |
9 |
Correct |
47 ms |
95360 KB |
Output is correct |
10 |
Correct |
40 ms |
95340 KB |
Output is correct |
11 |
Correct |
44 ms |
95344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
72 ms |
96336 KB |
Output isn't correct - not an optimal way |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1816 ms |
107656 KB |
Output isn't correct - not an optimal way |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
33 ms |
94728 KB |
Error - advice is too long |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2601 ms |
110820 KB |
Time limit exceeded |
2 |
Execution timed out |
2523 ms |
110796 KB |
Time limit exceeded |
3 |
Incorrect |
2298 ms |
110960 KB |
Output isn't correct - not an optimal way |
4 |
Incorrect |
2185 ms |
110704 KB |
Output isn't correct - not an optimal way |
5 |
Incorrect |
2163 ms |
110948 KB |
Output isn't correct - not an optimal way |
6 |
Incorrect |
2155 ms |
110704 KB |
Output isn't correct - not an optimal way |
7 |
Incorrect |
2138 ms |
110696 KB |
Output isn't correct - not an optimal way |
8 |
Incorrect |
2239 ms |
110732 KB |
Output isn't correct - not an optimal way |
9 |
Incorrect |
2267 ms |
110732 KB |
Output isn't correct - not an optimal way |
10 |
Execution timed out |
2542 ms |
110720 KB |
Time limit exceeded |