#include "Annalib.h"
#include <vector>
#include <iostream>
#include <string>
using namespace std;
namespace
{
using vi = vector<int>;
using ll = long long;
#define sz(x) int(x.size())
vector<string> key = vector<string>{string{""}, string{"0"}, string{"1"}, string{"00"}, string{"10"}, string{"11"}, string{"0"}, string{"01"}};
}
void Anna(int N, ll X, int K, int P[])
{
string bs(200, '0');
for(int b = 0; b < 200; b++)
{
bs[b] = (X%2) + '0';
X >>= 1;
}
vi br(N, 0); //broken
for(int i = 0; i < K; i++)
br[P[i]] = 1;
int cb = 0;
// cerr << "N = " << N << '\n';
for(int i = 0; i < N; i += 3)
{
// cerr << "i = " << i << "\n";
int cbr = br[i] + 2*br[i+1] + 4*br[i+2];
for(int b2 : {3, 4, 5, 7, 1, 2, 6})
{
bool valid = 1;
// cerr << "cbr = " << cbr << ", cb = " << cb << '\n';
// cerr << bs[cb] << ' ' << bs[cb+1] << '\n';
for(int f = 0; f < sz(key[b2]); f++)
if(key[b2][f] != bs[cb+f])
valid = 0;
if(!valid) continue;
// cerr << "going for " << b2 << '\n';
if((b2 & cbr) == 0)
{
cb += sz(key[b2]);
for(int j = 0; j < 3; j++)
{
// cerr << "set : " << i+j << '\n';
Set(i + j, (b2 >> j) & 1);
}
break;
}
}
}
// cerr << "terminated\n";
}
#include "Brunolib.h"
#include <vector>
#include <string>
using namespace std;
namespace
{
using vi = vector<int>;
using ll = long long;
#define sz(x) int(x.size())
vector<string> key = vector<string>{string{""}, string{"0"}, string{"1"}, string{"00"}, string{"10"}, string{"11"}, string{"0"}, string{"01"}};
}
ll Bruno(int N, int A[])
{
string res_s;
for(int i = 0; i < N; i += 3)
{
int z = A[i] + 2*A[i+1] + 4*A[i+2];
res_s += key[z];
}
ll bs = 1;
ll res = 0;
for(int i = 0; i < 60; i++)
{
if(res_s[i] == '1')
res += bs;
bs *= 2;
}
return res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
520 KB |
Wrong Answer [4] |
2 |
Incorrect |
0 ms |
520 KB |
Wrong Answer [4] |
3 |
Incorrect |
0 ms |
512 KB |
Wrong Answer [4] |
4 |
Incorrect |
0 ms |
508 KB |
Wrong Answer [4] |
5 |
Incorrect |
0 ms |
512 KB |
Wrong Answer [4] |
6 |
Incorrect |
1 ms |
520 KB |
Wrong Answer [4] |
7 |
Incorrect |
0 ms |
520 KB |
Wrong Answer [4] |
8 |
Incorrect |
1 ms |
512 KB |
Wrong Answer [4] |
9 |
Incorrect |
0 ms |
520 KB |
Wrong Answer [4] |
10 |
Incorrect |
1 ms |
524 KB |
Wrong Answer [4] |
11 |
Incorrect |
0 ms |
512 KB |
Wrong Answer [4] |
12 |
Incorrect |
0 ms |
512 KB |
Wrong Answer [4] |
13 |
Incorrect |
0 ms |
520 KB |
Wrong Answer [4] |
14 |
Incorrect |
0 ms |
512 KB |
Wrong Answer [4] |
15 |
Incorrect |
0 ms |
520 KB |
Wrong Answer [4] |
16 |
Incorrect |
1 ms |
512 KB |
Wrong Answer [4] |
17 |
Incorrect |
1 ms |
512 KB |
Wrong Answer [4] |
18 |
Incorrect |
0 ms |
520 KB |
Wrong Answer [4] |
19 |
Incorrect |
1 ms |
516 KB |
Wrong Answer [4] |
20 |
Incorrect |
0 ms |
520 KB |
Wrong Answer [4] |
21 |
Incorrect |
0 ms |
520 KB |
Wrong Answer [4] |
22 |
Incorrect |
0 ms |
460 KB |
Wrong Answer [4] |
23 |
Incorrect |
0 ms |
508 KB |
Wrong Answer [4] |
24 |
Incorrect |
0 ms |
520 KB |
Wrong Answer [4] |
25 |
Incorrect |
0 ms |
520 KB |
Wrong Answer [4] |
26 |
Incorrect |
0 ms |
524 KB |
Wrong Answer [4] |
27 |
Incorrect |
0 ms |
520 KB |
Wrong Answer [4] |
28 |
Incorrect |
0 ms |
512 KB |
Wrong Answer [4] |
29 |
Incorrect |
0 ms |
520 KB |
Wrong Answer [4] |
30 |
Incorrect |
1 ms |
512 KB |
Wrong Answer [4] |
31 |
Incorrect |
0 ms |
512 KB |
Wrong Answer [4] |
32 |
Incorrect |
1 ms |
520 KB |
Wrong Answer [4] |
33 |
Incorrect |
1 ms |
508 KB |
Wrong Answer [4] |
34 |
Incorrect |
1 ms |
520 KB |
Wrong Answer [4] |
35 |
Incorrect |
1 ms |
520 KB |
Wrong Answer [4] |
36 |
Incorrect |
0 ms |
512 KB |
Wrong Answer [4] |
37 |
Incorrect |
0 ms |
520 KB |
Wrong Answer [4] |
38 |
Incorrect |
0 ms |
520 KB |
Wrong Answer [4] |
39 |
Incorrect |
0 ms |
512 KB |
Wrong Answer [4] |
40 |
Incorrect |
0 ms |
520 KB |
Wrong Answer [4] |