#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
int num[] = {0, 0, 1, 0, 0, 1, 2, 3};
int sd[] = {0, 1, 1, 0, 2, 2, 2, 2};
void Anna(int n, long long X, int k, int P[])
{
vector <int> A;
vector <int> G;
for(int i = 0; i < n; i++)
{
A.push_back(X & 1);
X >>= 1;
G.push_back(0);
}
for(int i = 0; i < k; i++)
{
G[P[i]] = 1;
}
int pos = 0;
for(int i = 0; i < n; i += 3)
{
int tmp = G[i] * 4 + G[i + 1] * 2 + G[i + 2];
int t = 0;
for(int j = 0; j < 8; j++)
{
if((tmp & j) == 0)
{
int zz = num[j], nn = 1;
for(int k = 0; k < sd[j]; k++)
{
zz -= nn * A[pos + k];
nn *= 2;
}
if(zz == 0 and sd[t] < sd[j])
{
t = j;
}
}
}
for(int j = 0; j < 3; j++)
{
Set(i + j, (t >> (2 - j)) & 1);
}
pos += sd[t];
}
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
int num[] = {0, 0, 1, 0, 0, 1, 2, 3};
int sd[] = {0, 1, 1, 0, 2, 2, 2, 2};
long long Bruno(int n, int A[])
{
vector <int> V;
for(int i = 0; i < n; i += 3)
{
int tmp = A[i] * 4 + A[i + 1] * 2 + A[i + 2];
for(int j = 0; j < sd[tmp]; j++)
{
V.push_back((num[tmp] >> j) & 1);
}
}
long long ans = 0, bit = 1;
for(int i = 0; i < 60; i++)
{
ans += bit * V[i];
bit *= 2;
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
40 ms |
2184 KB |
Output is partially correct - L* = 23 |
2 |
Partially correct |
41 ms |
2340 KB |
Output is partially correct - L* = 23 |
3 |
Partially correct |
41 ms |
2240 KB |
Output is partially correct - L* = 23 |
4 |
Partially correct |
41 ms |
2224 KB |
Output is partially correct - L* = 23 |
5 |
Partially correct |
46 ms |
2368 KB |
Output is partially correct - L* = 20 |
6 |
Partially correct |
46 ms |
2272 KB |
Output is partially correct - L* = 25 |
7 |
Partially correct |
41 ms |
2340 KB |
Output is partially correct - L* = 20 |
8 |
Partially correct |
43 ms |
2288 KB |
Output is partially correct - L* = 25 |
9 |
Partially correct |
41 ms |
2296 KB |
Output is partially correct - L* = 22 |
10 |
Partially correct |
41 ms |
2316 KB |
Output is partially correct - L* = 23 |
11 |
Partially correct |
54 ms |
2252 KB |
Output is partially correct - L* = 21 |
12 |
Partially correct |
42 ms |
2204 KB |
Output is partially correct - L* = 22 |
13 |
Partially correct |
44 ms |
2544 KB |
Output is partially correct - L* = 23 |
14 |
Partially correct |
46 ms |
2292 KB |
Output is partially correct - L* = 26 |
15 |
Partially correct |
41 ms |
2204 KB |
Output is partially correct - L* = 34 |
16 |
Partially correct |
50 ms |
2228 KB |
Output is partially correct - L* = 22 |
17 |
Partially correct |
52 ms |
2268 KB |
Output is partially correct - L* = 21 |
18 |
Partially correct |
41 ms |
2376 KB |
Output is partially correct - L* = 24 |
19 |
Partially correct |
41 ms |
2396 KB |
Output is partially correct - L* = 23 |
20 |
Partially correct |
41 ms |
2224 KB |
Output is partially correct - L* = 26 |
21 |
Partially correct |
46 ms |
2208 KB |
Output is partially correct - L* = 30 |
22 |
Partially correct |
50 ms |
2260 KB |
Output is partially correct - L* = 22 |
23 |
Partially correct |
49 ms |
2264 KB |
Output is partially correct - L* = 21 |
24 |
Partially correct |
45 ms |
2296 KB |
Output is partially correct - L* = 25 |
25 |
Partially correct |
40 ms |
2284 KB |
Output is partially correct - L* = 20 |
26 |
Partially correct |
45 ms |
2328 KB |
Output is partially correct - L* = 23 |
27 |
Partially correct |
43 ms |
2444 KB |
Output is partially correct - L* = 23 |
28 |
Partially correct |
41 ms |
2356 KB |
Output is partially correct - L* = 21 |
29 |
Partially correct |
41 ms |
2196 KB |
Output is partially correct - L* = 29 |
30 |
Partially correct |
41 ms |
2252 KB |
Output is partially correct - L* = 21 |
31 |
Partially correct |
41 ms |
2352 KB |
Output is partially correct - L* = 22 |
32 |
Partially correct |
41 ms |
2188 KB |
Output is partially correct - L* = 30 |
33 |
Partially correct |
41 ms |
2204 KB |
Output is partially correct - L* = 20 |
34 |
Partially correct |
41 ms |
2204 KB |
Output is partially correct - L* = 22 |
35 |
Partially correct |
40 ms |
2196 KB |
Output is partially correct - L* = 23 |
36 |
Partially correct |
41 ms |
2276 KB |
Output is partially correct - L* = 23 |
37 |
Partially correct |
41 ms |
2288 KB |
Output is partially correct - L* = 24 |
38 |
Partially correct |
41 ms |
2308 KB |
Output is partially correct - L* = 22 |
39 |
Partially correct |
46 ms |
2160 KB |
Output is partially correct - L* = 20 |
40 |
Partially correct |
45 ms |
2380 KB |
Output is partially correct - L* = 21 |