#include <bits/stdc++.h>
#include <Annalib.h>
using namespace std;
void Anna( int N, long long X, int K, int P[] ){
vector<int> L(N,-2);
stack<int> B;
while(X) B.push(X&1), X>>=1;
set<int> used;
for(int i = 0;i < K;i++) Set(P[i],0),L[P[i]] = -1, used.insert(P[i]);
for(int i = 0;i < N;i++){
if(L[i] == -1) continue;
int cnt = 0;
while(i+cnt < N and L[i+cnt] == -2) cnt++;
// cout << i << "-" << i+cnt-1 << "\n";
int Pcnt = 0;
if(cnt >= 68 and B.size() >= 60) {
cnt-=68;
for(int j = 0;j < 7;j++) {
used.insert(i+j);
Set(i+j,1);
}
used.insert(i+7);
Set(i+7,0);
for(int j = 0;j < 60;j++) {
used.insert(i+8+j);
Set(i+8+j,B.top());
B.pop();
}
Pcnt++;
i += 68;
}
if(cnt >= 39 and B.size() >= 32) {
cnt-=39;
for(int j = 0;j < 6;j++) {
used.insert(i+j);
Set(i+j,1);
}
used.insert(i+6);
Set(i+6,0);
for(int j = 0;j < 32;j++) {
used.insert(i+7+j);
Set(i+7+j,B.top());
B.pop();
}
Pcnt++;
i += 39;
}
if(cnt >= 22 and B.size() >= 16) {
cnt-=22;
for(int j = 0;j < 5;j++) {
used.insert(i+j);
Set(i+j,1);
}
used.insert(i+5);
Set(i+5,0);
for(int j = 0;j < 16;j++) {
used.insert(i+6+j);
Set(i+6+j,B.top());
B.pop();
}
Pcnt++;
i += 22;
}
if(cnt >= 13 and B.size() >= 8) {
cnt-=13;
for(int j = 0;j < 4;j++) {
used.insert(i+j);
Set(i+j,1);
}
used.insert(i+4);
Set(i+4,0);
for(int j = 0;j < 8;j++) {
used.insert(i+5+j);
Set(i+5+j,B.top());
B.pop();
}
Pcnt++;
i += 13;
}
if(cnt >= 8 and B.size() >= 4) {
cnt-=8;
for(int j = 0;j < 3;j++) {
used.insert(i+j);
Set(i+j,1);
}
used.insert(i+3);
Set(i+3,0);
for(int j = 0;j < 4;j++) {
used.insert(i+4+j);
Set(i+4+j,B.top());
B.pop();
}
Pcnt++;
i += 8;
}
if(cnt >= 5 and B.size() >= 2) {
cnt-=5;
for(int j = 0;j < 2;j++) {
used.insert(i+j);
Set(i+j,1);
}
used.insert(i+2);
Set(i+2,0);
for(int j = 0;j < 2;j++) {
used.insert(i+3+j);
Set(i+3+j,B.top());
B.pop();
}
Pcnt++;
i += 5;
}
if(cnt >= 3 and B.size() >= 1) {
cnt-=3;
used.insert(i);
used.insert(i+1);
used.insert(i+2);
Set(i,1);
Set(i+1,0);
Set(i+2,B.top());
B.pop();
Pcnt++;
i += 3;
}
if(Pcnt) i--;
}
for(int i = 0;i < N;i++) {
if(used.count(i)) continue;
Set(i,0);
}
}
#include <bits/stdc++.h>
#include <Brunolib.h>
using namespace std;
long long Bruno( int N, int A[] ){
long long X = 0;
for(int i = 0;i < N-1;i++){
if(A[i] == 0) continue;
int cnt = 0;
while(A[i] == 1) cnt++,i++;
i++;
for(int j = 0; j < (1<<(cnt-1));j++) {
X<<=1;
X|=A[i+j];
}
i+=(1<<(cnt-1))-1;
}
return X;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
34 ms |
2748 KB |
Output isn't correct - L* = 0 |
2 |
Partially correct |
35 ms |
2784 KB |
Output isn't correct - L* = 0 |
3 |
Partially correct |
35 ms |
2776 KB |
Output isn't correct - L* = 0 |
4 |
Partially correct |
34 ms |
2760 KB |
Output isn't correct - L* = 0 |
5 |
Partially correct |
34 ms |
2756 KB |
Output isn't correct - L* = 0 |
6 |
Partially correct |
34 ms |
2776 KB |
Output isn't correct - L* = 0 |
7 |
Partially correct |
34 ms |
2684 KB |
Output isn't correct - L* = 0 |
8 |
Partially correct |
34 ms |
2756 KB |
Output isn't correct - L* = 0 |
9 |
Partially correct |
34 ms |
3388 KB |
Output isn't correct - L* = 0 |
10 |
Partially correct |
34 ms |
2752 KB |
Output isn't correct - L* = 0 |
11 |
Partially correct |
34 ms |
2828 KB |
Output isn't correct - L* = 0 |
12 |
Partially correct |
34 ms |
2756 KB |
Output isn't correct - L* = 0 |
13 |
Partially correct |
34 ms |
2748 KB |
Output isn't correct - L* = 0 |
14 |
Partially correct |
37 ms |
2752 KB |
Output isn't correct - L* = 0 |
15 |
Partially correct |
35 ms |
2776 KB |
Output isn't correct - L* = 0 |
16 |
Partially correct |
37 ms |
2752 KB |
Output isn't correct - L* = 0 |
17 |
Partially correct |
34 ms |
2632 KB |
Output isn't correct - L* = 0 |
18 |
Partially correct |
34 ms |
2772 KB |
Output isn't correct - L* = 0 |
19 |
Partially correct |
34 ms |
2704 KB |
Output isn't correct - L* = 0 |
20 |
Partially correct |
34 ms |
2756 KB |
Output isn't correct - L* = 0 |
21 |
Partially correct |
41 ms |
2740 KB |
Output isn't correct - L* = 0 |
22 |
Partially correct |
34 ms |
2692 KB |
Output isn't correct - L* = 0 |
23 |
Partially correct |
38 ms |
2768 KB |
Output isn't correct - L* = 0 |
24 |
Partially correct |
34 ms |
2776 KB |
Output isn't correct - L* = 0 |
25 |
Partially correct |
35 ms |
2996 KB |
Output isn't correct - L* = 0 |
26 |
Partially correct |
35 ms |
2748 KB |
Output isn't correct - L* = 0 |
27 |
Partially correct |
34 ms |
2684 KB |
Output isn't correct - L* = 0 |
28 |
Partially correct |
41 ms |
2840 KB |
Output isn't correct - L* = 0 |
29 |
Partially correct |
34 ms |
2864 KB |
Output isn't correct - L* = 0 |
30 |
Partially correct |
35 ms |
2684 KB |
Output isn't correct - L* = 0 |
31 |
Partially correct |
34 ms |
2744 KB |
Output isn't correct - L* = 0 |
32 |
Partially correct |
36 ms |
2696 KB |
Output isn't correct - L* = 0 |
33 |
Partially correct |
37 ms |
2688 KB |
Output isn't correct - L* = 0 |
34 |
Partially correct |
34 ms |
2772 KB |
Output isn't correct - L* = 0 |
35 |
Partially correct |
35 ms |
2964 KB |
Output isn't correct - L* = 0 |
36 |
Partially correct |
34 ms |
2776 KB |
Output isn't correct - L* = 0 |
37 |
Partially correct |
39 ms |
2748 KB |
Output isn't correct - L* = 0 |
38 |
Partially correct |
34 ms |
2692 KB |
Output isn't correct - L* = 0 |
39 |
Partially correct |
34 ms |
2776 KB |
Output isn't correct - L* = 0 |
40 |
Partially correct |
34 ms |
2680 KB |
Output isn't correct - L* = 0 |