#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
int num[] = {0, 0, 1, 1, 0, 1, 2, 3};
int sd[] = {0, 1, 1, 1, 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];
assert(G[i] + G[i + 1] + G[i + 2] + sd[t] >= 2);
}
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
int num[] = {0, 0, 1, 1, 0, 1, 2, 3};
int sd[] = {0, 1, 1, 1, 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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
2 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
3 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
4 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
5 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
6 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
7 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
8 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
9 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
10 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
11 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
12 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
13 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
14 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
15 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
16 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
17 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
18 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
19 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
20 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
21 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
22 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
23 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
24 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
25 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
26 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
27 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
28 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
29 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
30 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
31 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
32 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
33 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
34 |
Runtime error |
2 ms |
460 KB |
Execution killed with signal 6 |
35 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
36 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
37 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
38 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
39 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
40 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |