#include "Anna.h"
#include <utility>
#include <vector>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int Declare()
{
return 180;
}
std::pair<std::vector<int>, std::vector<int> > Anna(long long A)
{
vector < int > lf;
vector < int > rf;
while(A > 0)
{
rf.push_back(A % 2);
rf.push_back(A % 2);
rf.push_back(A % 2);
A /= 2;
}
for (int i = 0; i < rf.size(); i ++)
{
if (i % 2 == 0)
lf.push_back(1);
else
lf.push_back(0);
}
/**cout << "up" << endl;
for (int i = 0; i < lf.size(); i ++)
cout << lf[i] << " ";
cout << endl;
cout << "down" << endl;
for (int i = 0; i < rf.size(); i ++)
cout << rf[i] << " ";
cout << endl;*/
return make_pair(lf, rf);
}
#include "Bruno.h"
#include <utility>
#include <vector>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
long long Bruno(std::vector<int> u)
{
ll ans = 0, last = 0, bit = 0;
ll pref = 0;
/**for (int cur : u)
cout << cur << " ";
cout << endl;*/
for (int i = 0; i < u.size(); i ++)
{
ll val = pref + u[i];
pref += u[i];
val = val - (i + 1 - val);
ll ost = val % 3;
if (ost < 0)
ost += 3;
///cout << pref << " : " << val << " " << val % 3 << endl;
if (ost <= 1)
{
val -= ost;
if (last == -1e9)
last = val / 3;
else
if (val / 3 > last)
{
last = val / 3;
ans = ans + ((ll)(1) << bit);
bit ++;
}
else
if (val / 3 < last)
{
last = val / 3;
bit ++;
}
}
}
//cout << endl;
//cout << ans << endl;
return ans;
}
Compilation message
Anna.cpp: In function 'std::pair<std::vector<int>, std::vector<int> > Anna(long long int)':
Anna.cpp:25:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
25 | for (int i = 0; i < rf.size(); i ++)
| ~~^~~~~~~~~~~
Bruno.cpp: In function 'long long int Bruno(std::vector<int>)':
Bruno.cpp:18:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
18 | for (int i = 0; i < u.size(); i ++)
| ~~^~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
788 KB |
Output is correct |
2 |
Correct |
15 ms |
1144 KB |
Output is correct |
3 |
Correct |
18 ms |
1428 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
788 KB |
Output is correct |
2 |
Correct |
15 ms |
1144 KB |
Output is correct |
3 |
Correct |
18 ms |
1428 KB |
Output is correct |
4 |
Correct |
32 ms |
1784 KB |
Output is correct |
5 |
Correct |
28 ms |
1884 KB |
Output is correct |
6 |
Correct |
28 ms |
1784 KB |
Output is correct |
7 |
Correct |
27 ms |
1876 KB |
Output is correct |
8 |
Correct |
28 ms |
1804 KB |
Output is correct |
9 |
Correct |
27 ms |
1824 KB |
Output is correct |
10 |
Correct |
26 ms |
1800 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
788 KB |
Output is correct |
2 |
Correct |
15 ms |
1144 KB |
Output is correct |
3 |
Correct |
18 ms |
1428 KB |
Output is correct |
4 |
Correct |
32 ms |
1784 KB |
Output is correct |
5 |
Correct |
28 ms |
1884 KB |
Output is correct |
6 |
Correct |
28 ms |
1784 KB |
Output is correct |
7 |
Correct |
27 ms |
1876 KB |
Output is correct |
8 |
Correct |
28 ms |
1804 KB |
Output is correct |
9 |
Correct |
27 ms |
1824 KB |
Output is correct |
10 |
Correct |
26 ms |
1800 KB |
Output is correct |
11 |
Correct |
30 ms |
1768 KB |
Output is correct |
12 |
Correct |
30 ms |
1800 KB |
Output is correct |
13 |
Correct |
30 ms |
1932 KB |
Output is correct |
14 |
Correct |
30 ms |
1912 KB |
Output is correct |
15 |
Correct |
33 ms |
1848 KB |
Output is correct |
16 |
Correct |
30 ms |
1756 KB |
Output is correct |
17 |
Correct |
27 ms |
1904 KB |
Output is correct |
18 |
Correct |
26 ms |
1788 KB |
Output is correct |
19 |
Correct |
26 ms |
1784 KB |
Output is correct |
20 |
Correct |
30 ms |
1784 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
788 KB |
Output is correct |
2 |
Correct |
15 ms |
1144 KB |
Output is correct |
3 |
Correct |
18 ms |
1428 KB |
Output is correct |
4 |
Correct |
32 ms |
1784 KB |
Output is correct |
5 |
Correct |
28 ms |
1884 KB |
Output is correct |
6 |
Correct |
28 ms |
1784 KB |
Output is correct |
7 |
Correct |
27 ms |
1876 KB |
Output is correct |
8 |
Correct |
28 ms |
1804 KB |
Output is correct |
9 |
Correct |
27 ms |
1824 KB |
Output is correct |
10 |
Correct |
26 ms |
1800 KB |
Output is correct |
11 |
Correct |
30 ms |
1768 KB |
Output is correct |
12 |
Correct |
30 ms |
1800 KB |
Output is correct |
13 |
Correct |
30 ms |
1932 KB |
Output is correct |
14 |
Correct |
30 ms |
1912 KB |
Output is correct |
15 |
Correct |
33 ms |
1848 KB |
Output is correct |
16 |
Correct |
30 ms |
1756 KB |
Output is correct |
17 |
Correct |
27 ms |
1904 KB |
Output is correct |
18 |
Correct |
26 ms |
1788 KB |
Output is correct |
19 |
Correct |
26 ms |
1784 KB |
Output is correct |
20 |
Correct |
30 ms |
1784 KB |
Output is correct |
21 |
Correct |
36 ms |
2100 KB |
Output is correct |
22 |
Correct |
33 ms |
2120 KB |
Output is correct |
23 |
Correct |
33 ms |
2224 KB |
Output is correct |
24 |
Correct |
33 ms |
2208 KB |
Output is correct |
25 |
Correct |
38 ms |
2124 KB |
Output is correct |
26 |
Correct |
34 ms |
2088 KB |
Output is correct |
27 |
Correct |
32 ms |
2372 KB |
Output is correct |
28 |
Correct |
30 ms |
1832 KB |
Output is correct |
29 |
Correct |
30 ms |
1820 KB |
Output is correct |
30 |
Correct |
30 ms |
1828 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
788 KB |
Output is correct |
2 |
Correct |
15 ms |
1144 KB |
Output is correct |
3 |
Correct |
18 ms |
1428 KB |
Output is correct |
4 |
Correct |
32 ms |
1784 KB |
Output is correct |
5 |
Correct |
28 ms |
1884 KB |
Output is correct |
6 |
Correct |
28 ms |
1784 KB |
Output is correct |
7 |
Correct |
27 ms |
1876 KB |
Output is correct |
8 |
Correct |
28 ms |
1804 KB |
Output is correct |
9 |
Correct |
27 ms |
1824 KB |
Output is correct |
10 |
Correct |
26 ms |
1800 KB |
Output is correct |
11 |
Correct |
30 ms |
1768 KB |
Output is correct |
12 |
Correct |
30 ms |
1800 KB |
Output is correct |
13 |
Correct |
30 ms |
1932 KB |
Output is correct |
14 |
Correct |
30 ms |
1912 KB |
Output is correct |
15 |
Correct |
33 ms |
1848 KB |
Output is correct |
16 |
Correct |
30 ms |
1756 KB |
Output is correct |
17 |
Correct |
27 ms |
1904 KB |
Output is correct |
18 |
Correct |
26 ms |
1788 KB |
Output is correct |
19 |
Correct |
26 ms |
1784 KB |
Output is correct |
20 |
Correct |
30 ms |
1784 KB |
Output is correct |
21 |
Correct |
36 ms |
2100 KB |
Output is correct |
22 |
Correct |
33 ms |
2120 KB |
Output is correct |
23 |
Correct |
33 ms |
2224 KB |
Output is correct |
24 |
Correct |
33 ms |
2208 KB |
Output is correct |
25 |
Correct |
38 ms |
2124 KB |
Output is correct |
26 |
Correct |
34 ms |
2088 KB |
Output is correct |
27 |
Correct |
32 ms |
2372 KB |
Output is correct |
28 |
Correct |
30 ms |
1832 KB |
Output is correct |
29 |
Correct |
30 ms |
1820 KB |
Output is correct |
30 |
Correct |
30 ms |
1828 KB |
Output is correct |
31 |
Correct |
43 ms |
2736 KB |
Output is correct |
32 |
Correct |
43 ms |
2512 KB |
Output is correct |
33 |
Correct |
43 ms |
2528 KB |
Output is correct |
34 |
Correct |
43 ms |
2556 KB |
Output is correct |
35 |
Correct |
50 ms |
2476 KB |
Output is correct |
36 |
Correct |
41 ms |
2444 KB |
Output is correct |
37 |
Correct |
41 ms |
2600 KB |
Output is correct |
38 |
Correct |
41 ms |
2224 KB |
Output is correct |
39 |
Correct |
38 ms |
2208 KB |
Output is correct |
40 |
Correct |
47 ms |
2412 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
66 ms |
3472 KB |
Output is partially correct |
2 |
Partially correct |
68 ms |
3556 KB |
Output is partially correct |
3 |
Partially correct |
67 ms |
3452 KB |
Output is partially correct |
4 |
Partially correct |
71 ms |
3540 KB |
Output is partially correct |
5 |
Partially correct |
66 ms |
3592 KB |
Output is partially correct |
6 |
Partially correct |
67 ms |
3532 KB |
Output is partially correct |
7 |
Partially correct |
68 ms |
3552 KB |
Output is partially correct |
8 |
Partially correct |
67 ms |
3788 KB |
Output is partially correct |
9 |
Partially correct |
66 ms |
3456 KB |
Output is partially correct |
10 |
Partially correct |
66 ms |
3520 KB |
Output is partially correct |
11 |
Partially correct |
68 ms |
3428 KB |
Output is partially correct |
12 |
Partially correct |
66 ms |
3656 KB |
Output is partially correct |
13 |
Partially correct |
65 ms |
3468 KB |
Output is partially correct |
14 |
Partially correct |
62 ms |
3472 KB |
Output is partially correct |
15 |
Partially correct |
61 ms |
3384 KB |
Output is partially correct |
16 |
Partially correct |
63 ms |
3648 KB |
Output is partially correct |
17 |
Partially correct |
59 ms |
3392 KB |
Output is partially correct |
18 |
Partially correct |
64 ms |
3444 KB |
Output is partially correct |
19 |
Partially correct |
60 ms |
3440 KB |
Output is partially correct |
20 |
Partially correct |
59 ms |
3588 KB |
Output is partially correct |