#include "Annalib.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(int i = 0;i < n;i ++)
static ll fg;
static vector<ll> try_one(int N, ll X, vector<ll> &v)
{
X = X * 2 + 0;
ll ct = 0;
vector<ll> d(N, 0);
REP(i, N)
{
ll a = (X & 1) > 0;
if(ct == 61 || i >= N - 1)d[i] = 0;
else if(v[i] && (!a || v[i + 1]))d[i] = 1, d[i + 1] = a,i += 1, ct += 1, X >>= 1;
else d[i] = 0;
}
if(ct == 61)fg = 1;
return d;
}
static vector<ll> try_two(int N, ll X, vector<ll> &v)
{
X = X * 2 + 1;
ll ct = 0;
vector<ll> d(N, 0);
REP(i, N)
{
ll a = (X & 1) > 0;
ll b = (X & 2) > 0;
if(ct == 61 || i >= N - 2)d[i] = 0;
else if(ct == 0 && v[i] && (!a || v[i + 1]))d[i] = 1, d[i + 1] = a,i += 1, ct += 1, X >>= 1;
else if(ct != 0 && v[i] && (!a || v[i + 1]) && (!b || v[i + 2]))d[i] = 1, d[i + 1] = a, d[i + 2] = b, i += 2, ct += 2, X >>= 2;
else d[i] = 0;
}
if(ct == 61)fg = 1;
return d;
}
void Anna( int N, long long X, int K, int P[] ){
vector<ll> v(N, 1);
REP(i, K)v[P[i]] = 0;
vector<ll> d;
fg = 0;
d = try_one(N, X, v);
if(!fg)d = try_two(N, X, v);
REP(i, N)Set(i, d[i]);
}
#include "Brunolib.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(int i = 0;i < n;i ++)
long long Bruno( int N, int A[] ){
ll n = N;
ll tt = 0, t = 1, tp = -1;
REP(i, n)
{
if(A[i])
{
if(tp == -1)tp = A[i + 1], i ++;
else if(tp == 0)tt += t * A[i + 1], t <<= 1, i ++;
else tt += t * A[i + 1] + (t * 2) * A[i + 2], t <<= 2, i += 2;
}
}
return tt;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
41 ms |
3056 KB |
Output is partially correct - L* = 29 |
2 |
Partially correct |
41 ms |
3056 KB |
Output is partially correct - L* = 28 |
3 |
Partially correct |
41 ms |
3096 KB |
Output is partially correct - L* = 29 |
4 |
Partially correct |
41 ms |
3056 KB |
Output is partially correct - L* = 28 |
5 |
Partially correct |
43 ms |
3056 KB |
Output is partially correct - L* = 28 |
6 |
Partially correct |
41 ms |
3056 KB |
Output is partially correct - L* = 28 |
7 |
Partially correct |
41 ms |
2992 KB |
Output is partially correct - L* = 30 |
8 |
Partially correct |
41 ms |
3056 KB |
Output is partially correct - L* = 29 |
9 |
Partially correct |
44 ms |
3056 KB |
Output is partially correct - L* = 28 |
10 |
Partially correct |
44 ms |
3056 KB |
Output is partially correct - L* = 28 |
11 |
Partially correct |
44 ms |
3056 KB |
Output is partially correct - L* = 29 |
12 |
Partially correct |
41 ms |
3056 KB |
Output is partially correct - L* = 28 |
13 |
Partially correct |
41 ms |
3056 KB |
Output is partially correct - L* = 29 |
14 |
Partially correct |
41 ms |
3056 KB |
Output is partially correct - L* = 28 |
15 |
Partially correct |
41 ms |
3056 KB |
Output is partially correct - L* = 28 |
16 |
Partially correct |
41 ms |
3056 KB |
Output is partially correct - L* = 28 |
17 |
Partially correct |
41 ms |
3056 KB |
Output is partially correct - L* = 31 |
18 |
Partially correct |
41 ms |
3056 KB |
Output is partially correct - L* = 28 |
19 |
Partially correct |
41 ms |
3064 KB |
Output is partially correct - L* = 28 |
20 |
Partially correct |
41 ms |
3056 KB |
Output is partially correct - L* = 29 |
21 |
Partially correct |
41 ms |
3056 KB |
Output is partially correct - L* = 28 |
22 |
Partially correct |
43 ms |
3056 KB |
Output is partially correct - L* = 28 |
23 |
Partially correct |
41 ms |
3056 KB |
Output is partially correct - L* = 28 |
24 |
Partially correct |
41 ms |
3000 KB |
Output is partially correct - L* = 28 |
25 |
Partially correct |
41 ms |
3056 KB |
Output is partially correct - L* = 28 |
26 |
Partially correct |
41 ms |
3152 KB |
Output is partially correct - L* = 28 |
27 |
Partially correct |
41 ms |
3056 KB |
Output is partially correct - L* = 27 |
28 |
Partially correct |
41 ms |
3064 KB |
Output is partially correct - L* = 28 |
29 |
Partially correct |
41 ms |
3000 KB |
Output is partially correct - L* = 29 |
30 |
Partially correct |
41 ms |
3056 KB |
Output is partially correct - L* = 29 |
31 |
Partially correct |
41 ms |
3320 KB |
Output is partially correct - L* = 28 |
32 |
Partially correct |
41 ms |
3056 KB |
Output is partially correct - L* = 30 |
33 |
Partially correct |
41 ms |
3056 KB |
Output is partially correct - L* = 29 |
34 |
Partially correct |
41 ms |
3056 KB |
Output is partially correct - L* = 28 |
35 |
Partially correct |
41 ms |
3056 KB |
Output is partially correct - L* = 28 |
36 |
Partially correct |
41 ms |
3016 KB |
Output is partially correct - L* = 29 |
37 |
Partially correct |
41 ms |
3056 KB |
Output is partially correct - L* = 31 |
38 |
Partially correct |
41 ms |
3056 KB |
Output is partially correct - L* = 28 |
39 |
Partially correct |
41 ms |
3056 KB |
Output is partially correct - L* = 28 |
40 |
Partially correct |
43 ms |
3056 KB |
Output is partially correct - L* = 28 |