#include "Annalib.h"
#include "bits/stdc++.h"
using namespace std;
void Anna(int n, long long x, int k, int p[]){
vector<int> used(n);
for(int i=0;i<k;i++) used[p[i]] = 1;
const int M = 4;
vector<int> bit(M);
int t = 0;
for(int i=2;i<n && t < M;i++){
if(!used[i] && !used[i-1]){
used[i] = used[i-1] = 1;
bit[t++] = i;
}
}
vector<int> pos;
for(int i=0;i<n;){
if(used[i]) { i++; continue; }
int j = i;
while(j < n && !used[j]) j++;
pos.push_back(j - i);
i = j;
}
int b = -1;
for(int i=1;i<=(1 << M);i++){
int cnt = 0;
for(auto x : pos){
cnt += (x / (i + 1));
}
if(cnt >= 60 / i){
b = i;
}
}
if(!(~b)){
for(int i=0;i<n;i++) Set(i, 0);
//~ assert(false);
return;
}
for(int i=0;i<k;i++) Set(p[i], 0);
int v = b - 1;
for(int i=0;i<M;i++){
Set(bit[i] - 1, 1);
Set(bit[i], v & 1);
v >>= 1;
}
int l = 0;
for(int i=0;i<60;i+=b){
while(l<n){
int ok = 1;
for(int k=0;k<=b;k++){
if(l < k) ok = 0;
else if(used[l - k]) ok = 0;
}
if(ok) break;
l++;
}
//~ assert(l<n);
for(int j=b - 1;~j;j--){
Set(l - j, x & 1);
used[l - j] = 1;
x >>= 1;
}
used[l - b] = 1;
Set(l - b, 1);
}
for(int i=0;i<n;i++){
if(!used[i]){
Set(i, 0);
}
}
}
/*
2
150 14 1
2
150 9 2
0 1
*/
#include "Brunolib.h"
#include "bits/stdc++.h"
using namespace std;
long long Bruno( int n, int a[] ){
int b = 1, l = -1;
const int M = 4;
int val = 0, t = 0;
for(int i=0;i<n && t < M;i++){
if(!a[i]) continue;
if(a[i]){
val |= (a[i + 1] << t);
t++, i++, l = i + 1;
}
}
if(l == -1) return 0ll;
b = val + 1;
int bit = 0;
long long x = 0;
for(int i=l;i<n;i++){
if(a[i]){
for(int j=i+1;j<=i+b && bit < 60;j++){
x |= ((a[j] * 1ll) << bit);
bit++;
}
i += b;
}
}
//~ cout<<x<<endl;
return x;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
524 KB |
Wrong Answer [2] |
2 |
Incorrect |
0 ms |
508 KB |
Wrong Answer [2] |
3 |
Incorrect |
1 ms |
520 KB |
Wrong Answer [2] |
4 |
Incorrect |
0 ms |
460 KB |
Wrong Answer [2] |
5 |
Incorrect |
0 ms |
512 KB |
Wrong Answer [2] |
6 |
Incorrect |
0 ms |
512 KB |
Wrong Answer [2] |
7 |
Incorrect |
1 ms |
512 KB |
Wrong Answer [2] |
8 |
Incorrect |
0 ms |
520 KB |
Wrong Answer [2] |
9 |
Incorrect |
1 ms |
512 KB |
Wrong Answer [2] |
10 |
Incorrect |
0 ms |
512 KB |
Wrong Answer [2] |
11 |
Incorrect |
2 ms |
520 KB |
Wrong Answer [2] |
12 |
Incorrect |
1 ms |
520 KB |
Wrong Answer [2] |
13 |
Incorrect |
1 ms |
520 KB |
Wrong Answer [2] |
14 |
Incorrect |
0 ms |
512 KB |
Wrong Answer [2] |
15 |
Incorrect |
0 ms |
520 KB |
Wrong Answer [2] |
16 |
Incorrect |
1 ms |
520 KB |
Wrong Answer [2] |
17 |
Incorrect |
0 ms |
512 KB |
Wrong Answer [2] |
18 |
Incorrect |
0 ms |
512 KB |
Wrong Answer [2] |
19 |
Incorrect |
1 ms |
512 KB |
Wrong Answer [2] |
20 |
Incorrect |
0 ms |
520 KB |
Wrong Answer [2] |
21 |
Incorrect |
0 ms |
524 KB |
Wrong Answer [1] |
22 |
Incorrect |
0 ms |
512 KB |
Wrong Answer [2] |
23 |
Incorrect |
1 ms |
512 KB |
Wrong Answer [2] |
24 |
Incorrect |
0 ms |
516 KB |
Wrong Answer [2] |
25 |
Incorrect |
0 ms |
520 KB |
Wrong Answer [2] |
26 |
Incorrect |
0 ms |
512 KB |
Wrong Answer [2] |
27 |
Incorrect |
1 ms |
520 KB |
Wrong Answer [2] |
28 |
Incorrect |
0 ms |
512 KB |
Wrong Answer [2] |
29 |
Incorrect |
1 ms |
524 KB |
Wrong Answer [2] |
30 |
Incorrect |
0 ms |
512 KB |
Wrong Answer [2] |
31 |
Incorrect |
0 ms |
512 KB |
Wrong Answer [2] |
32 |
Incorrect |
0 ms |
520 KB |
Wrong Answer [2] |
33 |
Incorrect |
0 ms |
512 KB |
Wrong Answer [2] |
34 |
Incorrect |
0 ms |
520 KB |
Wrong Answer [2] |
35 |
Incorrect |
0 ms |
520 KB |
Wrong Answer [2] |
36 |
Incorrect |
1 ms |
512 KB |
Wrong Answer [2] |
37 |
Incorrect |
0 ms |
512 KB |
Wrong Answer [2] |
38 |
Incorrect |
1 ms |
520 KB |
Wrong Answer [2] |
39 |
Incorrect |
0 ms |
512 KB |
Wrong Answer [1] |
40 |
Incorrect |
0 ms |
496 KB |
Wrong Answer [2] |