#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
static const int BITS = 60;
static const int C = 3;
int Declare() {
return C * BITS;
}
pair<vector<int>, vector<int>> Anna(ll a) {
vector<int> v1, v2;
for(ll i = 0; i < C * BITS; i += 2){
v1.push_back(0);
v1.push_back(1);
}
for(ll i = 0; i < BITS; ++i){
ll bit = (a >> i) & 1ll;
for(ll j = 0; j < C; ++j)
v2.push_back(bit);
}
return {v1, v2};
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
static const int BITS = 60;
static const int C = 3;
ll Bruno(vector<int> u) {
ll curr = 0, prefix = 0;
vector<ll> bits;
for(ll i = 0; i < u.size(); ++i){
prefix += u[i] ? 1 : -1;
if(prefix <= curr - C){
bits.push_back(0);
curr -= C;
}
else if(prefix >= curr + C - 1){
bits.push_back(1);
curr += C;
}
}
ll ans = 0;
for(ll i = 0; i < bits.size(); ++i)
ans += bits[i] << i;
assert(bits.size() == BITS);
return ans;
}
Compilation message
Bruno.cpp: In function 'll Bruno(std::vector<int>)':
Bruno.cpp:14:21: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
14 | for(ll i = 0; i < u.size(); ++i){
| ~~^~~~~~~~~~
Bruno.cpp:28:21: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
28 | for(ll i = 0; i < bits.size(); ++i)
| ~~^~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
508 KB |
Output is correct |
2 |
Correct |
77 ms |
3364 KB |
Output is correct |
3 |
Correct |
94 ms |
3316 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
508 KB |
Output is correct |
2 |
Correct |
77 ms |
3364 KB |
Output is correct |
3 |
Correct |
94 ms |
3316 KB |
Output is correct |
4 |
Correct |
75 ms |
3412 KB |
Output is correct |
5 |
Correct |
71 ms |
3492 KB |
Output is correct |
6 |
Correct |
83 ms |
3404 KB |
Output is correct |
7 |
Correct |
95 ms |
3524 KB |
Output is correct |
8 |
Correct |
74 ms |
3412 KB |
Output is correct |
9 |
Correct |
68 ms |
3392 KB |
Output is correct |
10 |
Correct |
68 ms |
3356 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
508 KB |
Output is correct |
2 |
Correct |
77 ms |
3364 KB |
Output is correct |
3 |
Correct |
94 ms |
3316 KB |
Output is correct |
4 |
Correct |
75 ms |
3412 KB |
Output is correct |
5 |
Correct |
71 ms |
3492 KB |
Output is correct |
6 |
Correct |
83 ms |
3404 KB |
Output is correct |
7 |
Correct |
95 ms |
3524 KB |
Output is correct |
8 |
Correct |
74 ms |
3412 KB |
Output is correct |
9 |
Correct |
68 ms |
3392 KB |
Output is correct |
10 |
Correct |
68 ms |
3356 KB |
Output is correct |
11 |
Correct |
78 ms |
3524 KB |
Output is correct |
12 |
Correct |
80 ms |
3408 KB |
Output is correct |
13 |
Correct |
74 ms |
3480 KB |
Output is correct |
14 |
Correct |
77 ms |
3360 KB |
Output is correct |
15 |
Correct |
72 ms |
3364 KB |
Output is correct |
16 |
Correct |
83 ms |
3404 KB |
Output is correct |
17 |
Correct |
84 ms |
3328 KB |
Output is correct |
18 |
Correct |
74 ms |
3620 KB |
Output is correct |
19 |
Correct |
74 ms |
3568 KB |
Output is correct |
20 |
Correct |
75 ms |
3472 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
508 KB |
Output is correct |
2 |
Correct |
77 ms |
3364 KB |
Output is correct |
3 |
Correct |
94 ms |
3316 KB |
Output is correct |
4 |
Correct |
75 ms |
3412 KB |
Output is correct |
5 |
Correct |
71 ms |
3492 KB |
Output is correct |
6 |
Correct |
83 ms |
3404 KB |
Output is correct |
7 |
Correct |
95 ms |
3524 KB |
Output is correct |
8 |
Correct |
74 ms |
3412 KB |
Output is correct |
9 |
Correct |
68 ms |
3392 KB |
Output is correct |
10 |
Correct |
68 ms |
3356 KB |
Output is correct |
11 |
Correct |
78 ms |
3524 KB |
Output is correct |
12 |
Correct |
80 ms |
3408 KB |
Output is correct |
13 |
Correct |
74 ms |
3480 KB |
Output is correct |
14 |
Correct |
77 ms |
3360 KB |
Output is correct |
15 |
Correct |
72 ms |
3364 KB |
Output is correct |
16 |
Correct |
83 ms |
3404 KB |
Output is correct |
17 |
Correct |
84 ms |
3328 KB |
Output is correct |
18 |
Correct |
74 ms |
3620 KB |
Output is correct |
19 |
Correct |
74 ms |
3568 KB |
Output is correct |
20 |
Correct |
75 ms |
3472 KB |
Output is correct |
21 |
Correct |
90 ms |
3512 KB |
Output is correct |
22 |
Correct |
77 ms |
3376 KB |
Output is correct |
23 |
Correct |
75 ms |
3472 KB |
Output is correct |
24 |
Correct |
75 ms |
3448 KB |
Output is correct |
25 |
Correct |
83 ms |
3412 KB |
Output is correct |
26 |
Correct |
76 ms |
3440 KB |
Output is correct |
27 |
Correct |
79 ms |
3436 KB |
Output is correct |
28 |
Correct |
93 ms |
3512 KB |
Output is correct |
29 |
Correct |
78 ms |
3460 KB |
Output is correct |
30 |
Correct |
77 ms |
3328 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
508 KB |
Output is correct |
2 |
Correct |
77 ms |
3364 KB |
Output is correct |
3 |
Correct |
94 ms |
3316 KB |
Output is correct |
4 |
Correct |
75 ms |
3412 KB |
Output is correct |
5 |
Correct |
71 ms |
3492 KB |
Output is correct |
6 |
Correct |
83 ms |
3404 KB |
Output is correct |
7 |
Correct |
95 ms |
3524 KB |
Output is correct |
8 |
Correct |
74 ms |
3412 KB |
Output is correct |
9 |
Correct |
68 ms |
3392 KB |
Output is correct |
10 |
Correct |
68 ms |
3356 KB |
Output is correct |
11 |
Correct |
78 ms |
3524 KB |
Output is correct |
12 |
Correct |
80 ms |
3408 KB |
Output is correct |
13 |
Correct |
74 ms |
3480 KB |
Output is correct |
14 |
Correct |
77 ms |
3360 KB |
Output is correct |
15 |
Correct |
72 ms |
3364 KB |
Output is correct |
16 |
Correct |
83 ms |
3404 KB |
Output is correct |
17 |
Correct |
84 ms |
3328 KB |
Output is correct |
18 |
Correct |
74 ms |
3620 KB |
Output is correct |
19 |
Correct |
74 ms |
3568 KB |
Output is correct |
20 |
Correct |
75 ms |
3472 KB |
Output is correct |
21 |
Correct |
90 ms |
3512 KB |
Output is correct |
22 |
Correct |
77 ms |
3376 KB |
Output is correct |
23 |
Correct |
75 ms |
3472 KB |
Output is correct |
24 |
Correct |
75 ms |
3448 KB |
Output is correct |
25 |
Correct |
83 ms |
3412 KB |
Output is correct |
26 |
Correct |
76 ms |
3440 KB |
Output is correct |
27 |
Correct |
79 ms |
3436 KB |
Output is correct |
28 |
Correct |
93 ms |
3512 KB |
Output is correct |
29 |
Correct |
78 ms |
3460 KB |
Output is correct |
30 |
Correct |
77 ms |
3328 KB |
Output is correct |
31 |
Correct |
74 ms |
3328 KB |
Output is correct |
32 |
Correct |
75 ms |
3444 KB |
Output is correct |
33 |
Correct |
74 ms |
3428 KB |
Output is correct |
34 |
Correct |
81 ms |
3448 KB |
Output is correct |
35 |
Correct |
83 ms |
3532 KB |
Output is correct |
36 |
Correct |
71 ms |
3344 KB |
Output is correct |
37 |
Correct |
76 ms |
3492 KB |
Output is correct |
38 |
Correct |
83 ms |
3352 KB |
Output is correct |
39 |
Correct |
80 ms |
3492 KB |
Output is correct |
40 |
Correct |
79 ms |
3336 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
77 ms |
3384 KB |
Output is partially correct |
2 |
Partially correct |
78 ms |
3396 KB |
Output is partially correct |
3 |
Partially correct |
89 ms |
3464 KB |
Output is partially correct |
4 |
Partially correct |
76 ms |
3376 KB |
Output is partially correct |
5 |
Partially correct |
76 ms |
3524 KB |
Output is partially correct |
6 |
Partially correct |
87 ms |
3348 KB |
Output is partially correct |
7 |
Partially correct |
81 ms |
3452 KB |
Output is partially correct |
8 |
Partially correct |
74 ms |
3548 KB |
Output is partially correct |
9 |
Partially correct |
75 ms |
3548 KB |
Output is partially correct |
10 |
Partially correct |
84 ms |
3496 KB |
Output is partially correct |
11 |
Partially correct |
78 ms |
3348 KB |
Output is partially correct |
12 |
Partially correct |
75 ms |
3460 KB |
Output is partially correct |
13 |
Partially correct |
76 ms |
3428 KB |
Output is partially correct |
14 |
Partially correct |
72 ms |
3480 KB |
Output is partially correct |
15 |
Partially correct |
83 ms |
3512 KB |
Output is partially correct |
16 |
Partially correct |
89 ms |
3532 KB |
Output is partially correct |
17 |
Partially correct |
72 ms |
3436 KB |
Output is partially correct |
18 |
Partially correct |
75 ms |
3488 KB |
Output is partially correct |
19 |
Partially correct |
77 ms |
3576 KB |
Output is partially correct |
20 |
Partially correct |
81 ms |
3356 KB |
Output is partially correct |