#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(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 |
44 ms |
3056 KB |
Output is partially correct - L* = 14 |
2 |
Partially correct |
44 ms |
3312 KB |
Output is partially correct - L* = 14 |
3 |
Partially correct |
44 ms |
3048 KB |
Output is partially correct - L* = 14 |
4 |
Partially correct |
44 ms |
3056 KB |
Output is partially correct - L* = 15 |
5 |
Partially correct |
44 ms |
3312 KB |
Output is partially correct - L* = 15 |
6 |
Partially correct |
44 ms |
3312 KB |
Output is partially correct - L* = 17 |
7 |
Partially correct |
45 ms |
3312 KB |
Output is partially correct - L* = 15 |
8 |
Partially correct |
44 ms |
3312 KB |
Output is partially correct - L* = 14 |
9 |
Partially correct |
44 ms |
3056 KB |
Output is partially correct - L* = 18 |
10 |
Partially correct |
44 ms |
3056 KB |
Output is partially correct - L* = 14 |
11 |
Partially correct |
44 ms |
3312 KB |
Output is partially correct - L* = 17 |
12 |
Partially correct |
44 ms |
3312 KB |
Output is partially correct - L* = 14 |
13 |
Partially correct |
44 ms |
3312 KB |
Output is partially correct - L* = 15 |
14 |
Partially correct |
47 ms |
3312 KB |
Output is partially correct - L* = 15 |
15 |
Partially correct |
49 ms |
3312 KB |
Output is partially correct - L* = 16 |
16 |
Partially correct |
44 ms |
3056 KB |
Output is partially correct - L* = 17 |
17 |
Partially correct |
44 ms |
3120 KB |
Output is partially correct - L* = 19 |
18 |
Partially correct |
44 ms |
3312 KB |
Output is partially correct - L* = 16 |
19 |
Partially correct |
44 ms |
3312 KB |
Output is partially correct - L* = 18 |
20 |
Partially correct |
44 ms |
3256 KB |
Output is partially correct - L* = 14 |
21 |
Partially correct |
44 ms |
3056 KB |
Output is partially correct - L* = 14 |
22 |
Partially correct |
44 ms |
3312 KB |
Output is partially correct - L* = 14 |
23 |
Partially correct |
44 ms |
3056 KB |
Output is partially correct - L* = 15 |
24 |
Partially correct |
45 ms |
3312 KB |
Output is partially correct - L* = 17 |
25 |
Partially correct |
46 ms |
3312 KB |
Output is partially correct - L* = 16 |
26 |
Partially correct |
44 ms |
3312 KB |
Output is partially correct - L* = 16 |
27 |
Partially correct |
44 ms |
3312 KB |
Output is partially correct - L* = 14 |
28 |
Partially correct |
45 ms |
3312 KB |
Output is partially correct - L* = 15 |
29 |
Partially correct |
67 ms |
3288 KB |
Output is partially correct - L* = 15 |
30 |
Partially correct |
45 ms |
3056 KB |
Output is partially correct - L* = 14 |
31 |
Partially correct |
46 ms |
3312 KB |
Output is partially correct - L* = 14 |
32 |
Partially correct |
44 ms |
3056 KB |
Output is partially correct - L* = 18 |
33 |
Partially correct |
44 ms |
3256 KB |
Output is partially correct - L* = 15 |
34 |
Partially correct |
44 ms |
3312 KB |
Output is partially correct - L* = 16 |
35 |
Partially correct |
44 ms |
3320 KB |
Output is partially correct - L* = 14 |
36 |
Partially correct |
44 ms |
3312 KB |
Output is partially correct - L* = 14 |
37 |
Partially correct |
44 ms |
3312 KB |
Output is partially correct - L* = 14 |
38 |
Partially correct |
45 ms |
3056 KB |
Output is partially correct - L* = 18 |
39 |
Partially correct |
44 ms |
3056 KB |
Output is partially correct - L* = 15 |
40 |
Partially correct |
44 ms |
3056 KB |
Output is partially correct - L* = 14 |