#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pi = pair<lint, lint>;
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
namespace {
}
int Declare() {
return 180;
}
std::pair<std::vector<int>, std::vector<int> > Anna(long long A) {
vector<int> seq;
for(int i = 0; i < 60; i++) seq.push_back((A >> i) & 1);
vector<int> X, Y;
for(int i = 0; i < 60; ){
int j = i;
while(j < 60 && seq[i] == seq[j]) j++;
for(int k = 0; k < 2 * (j - i) + 1; k++) X.push_back(seq[i]);
i = j;
}
Y.resize(sz(X));
for(int i = 0; i < sz(X); i++){
Y[i] = (i + 1) % 2;
}
return make_pair(X, Y);
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pi = pair<lint, lint>;
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
namespace {
int variable_example = 0;
}
long long Bruno(std::vector<int> u) {
int ptr = 0;
int piv = 0, sum = 0;
int previous = -1;
vector<int> ans;
while(ptr < sz(u)){
int k = piv;
int U = (k + 3 - (previous == 1));
int D = (k - 3 + (previous == 0));
while(ptr < sz(u)){
sum += u[ptr++] * 2 - 1;
if(sum >= U) break;
if(sum <= D + 1) break;
}
if(sum == U) ans.push_back(1), previous = 1, piv = U;
else if(sum == D + 1) ans.push_back(0), previous = 0, piv = D;
}
assert(sz(ans) == 60);
lint dap = 0;
for(int i = 0; i < 60; i++) if(ans[i]) dap |= (1ll << i);
return dap;
}
Compilation message
Bruno.cpp:11:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
11 | int variable_example = 0;
| ^~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
520 KB |
Output is correct |
2 |
Correct |
57 ms |
2520 KB |
Output is correct |
3 |
Correct |
53 ms |
2656 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
520 KB |
Output is correct |
2 |
Correct |
57 ms |
2520 KB |
Output is correct |
3 |
Correct |
53 ms |
2656 KB |
Output is correct |
4 |
Correct |
54 ms |
2752 KB |
Output is correct |
5 |
Correct |
55 ms |
2780 KB |
Output is correct |
6 |
Correct |
54 ms |
2676 KB |
Output is correct |
7 |
Correct |
55 ms |
2628 KB |
Output is correct |
8 |
Correct |
59 ms |
2680 KB |
Output is correct |
9 |
Correct |
59 ms |
2660 KB |
Output is correct |
10 |
Correct |
55 ms |
2580 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
520 KB |
Output is correct |
2 |
Correct |
57 ms |
2520 KB |
Output is correct |
3 |
Correct |
53 ms |
2656 KB |
Output is correct |
4 |
Correct |
54 ms |
2752 KB |
Output is correct |
5 |
Correct |
55 ms |
2780 KB |
Output is correct |
6 |
Correct |
54 ms |
2676 KB |
Output is correct |
7 |
Correct |
55 ms |
2628 KB |
Output is correct |
8 |
Correct |
59 ms |
2680 KB |
Output is correct |
9 |
Correct |
59 ms |
2660 KB |
Output is correct |
10 |
Correct |
55 ms |
2580 KB |
Output is correct |
11 |
Correct |
66 ms |
2672 KB |
Output is correct |
12 |
Correct |
55 ms |
2748 KB |
Output is correct |
13 |
Correct |
55 ms |
2764 KB |
Output is correct |
14 |
Correct |
56 ms |
2632 KB |
Output is correct |
15 |
Correct |
64 ms |
2752 KB |
Output is correct |
16 |
Correct |
54 ms |
2668 KB |
Output is correct |
17 |
Correct |
56 ms |
2792 KB |
Output is correct |
18 |
Correct |
59 ms |
2724 KB |
Output is correct |
19 |
Correct |
69 ms |
2628 KB |
Output is correct |
20 |
Correct |
58 ms |
2624 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
520 KB |
Output is correct |
2 |
Correct |
57 ms |
2520 KB |
Output is correct |
3 |
Correct |
53 ms |
2656 KB |
Output is correct |
4 |
Correct |
54 ms |
2752 KB |
Output is correct |
5 |
Correct |
55 ms |
2780 KB |
Output is correct |
6 |
Correct |
54 ms |
2676 KB |
Output is correct |
7 |
Correct |
55 ms |
2628 KB |
Output is correct |
8 |
Correct |
59 ms |
2680 KB |
Output is correct |
9 |
Correct |
59 ms |
2660 KB |
Output is correct |
10 |
Correct |
55 ms |
2580 KB |
Output is correct |
11 |
Correct |
66 ms |
2672 KB |
Output is correct |
12 |
Correct |
55 ms |
2748 KB |
Output is correct |
13 |
Correct |
55 ms |
2764 KB |
Output is correct |
14 |
Correct |
56 ms |
2632 KB |
Output is correct |
15 |
Correct |
64 ms |
2752 KB |
Output is correct |
16 |
Correct |
54 ms |
2668 KB |
Output is correct |
17 |
Correct |
56 ms |
2792 KB |
Output is correct |
18 |
Correct |
59 ms |
2724 KB |
Output is correct |
19 |
Correct |
69 ms |
2628 KB |
Output is correct |
20 |
Correct |
58 ms |
2624 KB |
Output is correct |
21 |
Correct |
60 ms |
2752 KB |
Output is correct |
22 |
Correct |
57 ms |
2720 KB |
Output is correct |
23 |
Correct |
59 ms |
2776 KB |
Output is correct |
24 |
Correct |
54 ms |
2732 KB |
Output is correct |
25 |
Correct |
55 ms |
2680 KB |
Output is correct |
26 |
Correct |
53 ms |
2736 KB |
Output is correct |
27 |
Correct |
60 ms |
2772 KB |
Output is correct |
28 |
Correct |
55 ms |
2564 KB |
Output is correct |
29 |
Correct |
54 ms |
2692 KB |
Output is correct |
30 |
Correct |
55 ms |
2596 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
520 KB |
Output is correct |
2 |
Correct |
57 ms |
2520 KB |
Output is correct |
3 |
Correct |
53 ms |
2656 KB |
Output is correct |
4 |
Correct |
54 ms |
2752 KB |
Output is correct |
5 |
Correct |
55 ms |
2780 KB |
Output is correct |
6 |
Correct |
54 ms |
2676 KB |
Output is correct |
7 |
Correct |
55 ms |
2628 KB |
Output is correct |
8 |
Correct |
59 ms |
2680 KB |
Output is correct |
9 |
Correct |
59 ms |
2660 KB |
Output is correct |
10 |
Correct |
55 ms |
2580 KB |
Output is correct |
11 |
Correct |
66 ms |
2672 KB |
Output is correct |
12 |
Correct |
55 ms |
2748 KB |
Output is correct |
13 |
Correct |
55 ms |
2764 KB |
Output is correct |
14 |
Correct |
56 ms |
2632 KB |
Output is correct |
15 |
Correct |
64 ms |
2752 KB |
Output is correct |
16 |
Correct |
54 ms |
2668 KB |
Output is correct |
17 |
Correct |
56 ms |
2792 KB |
Output is correct |
18 |
Correct |
59 ms |
2724 KB |
Output is correct |
19 |
Correct |
69 ms |
2628 KB |
Output is correct |
20 |
Correct |
58 ms |
2624 KB |
Output is correct |
21 |
Correct |
60 ms |
2752 KB |
Output is correct |
22 |
Correct |
57 ms |
2720 KB |
Output is correct |
23 |
Correct |
59 ms |
2776 KB |
Output is correct |
24 |
Correct |
54 ms |
2732 KB |
Output is correct |
25 |
Correct |
55 ms |
2680 KB |
Output is correct |
26 |
Correct |
53 ms |
2736 KB |
Output is correct |
27 |
Correct |
60 ms |
2772 KB |
Output is correct |
28 |
Correct |
55 ms |
2564 KB |
Output is correct |
29 |
Correct |
54 ms |
2692 KB |
Output is correct |
30 |
Correct |
55 ms |
2596 KB |
Output is correct |
31 |
Correct |
57 ms |
2916 KB |
Output is correct |
32 |
Correct |
69 ms |
2784 KB |
Output is correct |
33 |
Correct |
60 ms |
2860 KB |
Output is correct |
34 |
Correct |
56 ms |
2880 KB |
Output is correct |
35 |
Correct |
61 ms |
2868 KB |
Output is correct |
36 |
Correct |
55 ms |
2968 KB |
Output is correct |
37 |
Correct |
60 ms |
2820 KB |
Output is correct |
38 |
Correct |
62 ms |
2764 KB |
Output is correct |
39 |
Correct |
55 ms |
2732 KB |
Output is correct |
40 |
Correct |
56 ms |
2936 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
69 ms |
3064 KB |
Output is partially correct |
2 |
Partially correct |
63 ms |
3116 KB |
Output is partially correct |
3 |
Partially correct |
63 ms |
3048 KB |
Output is partially correct |
4 |
Partially correct |
62 ms |
2984 KB |
Output is partially correct |
5 |
Partially correct |
65 ms |
3000 KB |
Output is partially correct |
6 |
Partially correct |
76 ms |
2900 KB |
Output is partially correct |
7 |
Partially correct |
62 ms |
3068 KB |
Output is partially correct |
8 |
Partially correct |
63 ms |
3004 KB |
Output is partially correct |
9 |
Partially correct |
62 ms |
3080 KB |
Output is partially correct |
10 |
Partially correct |
61 ms |
3008 KB |
Output is partially correct |
11 |
Partially correct |
66 ms |
2932 KB |
Output is partially correct |
12 |
Partially correct |
63 ms |
2976 KB |
Output is partially correct |
13 |
Partially correct |
59 ms |
3068 KB |
Output is partially correct |
14 |
Partially correct |
65 ms |
2820 KB |
Output is partially correct |
15 |
Partially correct |
59 ms |
2948 KB |
Output is partially correct |
16 |
Partially correct |
70 ms |
3064 KB |
Output is partially correct |
17 |
Partially correct |
68 ms |
2940 KB |
Output is partially correct |
18 |
Partially correct |
61 ms |
3096 KB |
Output is partially correct |
19 |
Partially correct |
63 ms |
3044 KB |
Output is partially correct |
20 |
Partially correct |
79 ms |
3080 KB |
Output is partially correct |