/*************************************
* author: marvinthang *
* created: 26.12.2023 15:37:58 *
*************************************/
#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define left ___left
#define right ___right
#define TIME (1.0 * clock() / CLOCKS_PER_SEC)
#define MASK(i) (1LL << (i))
#define BIT(x, i) ((x) >> (i) & 1)
#define __builtin_popcount __builtin_popcountll
#define ALL(v) (v).begin(), (v).end()
#define REP(i, n) for (int i = 0, _n = (n); i < _n; ++i)
#define REPD(i, n) for (int i = (n); i-- > 0; )
#define FOR(i, a, b) for (int i = (a), _b = (b); i < _b; ++i)
#define FORD(i, b, a) for (int i = (b), _a = (a); --i >= _a; )
#define FORE(i, a, b) for (int i = (a), _b = (b); i <= _b; ++i)
#define FORDE(i, b, a) for (int i = (b), _a = (a); i >= _a; --i)
#define scan_op(...) istream & operator >> (istream &in, __VA_ARGS__ &u)
#define print_op(...) ostream & operator << (ostream &out, const __VA_ARGS__ &u)
#ifdef LOCAL
#include "debug.h"
#else
#define file(name) if (fopen(name".inp", "r")) { freopen(name".inp", "r", stdin); freopen(name".out", "w", stdout); }
#define DB(...) 23
#define db(...) 23
#define debug(...) 23
#endif
template <class U, class V> scan_op(pair <U, V>) { return in >> u.first >> u.second; }
template <class T> scan_op(vector <T>) { for (size_t i = 0; i < u.size(); ++i) in >> u[i]; return in; }
template <class U, class V> print_op(pair <U, V>) { return out << '(' << u.first << ", " << u.second << ')'; }
template <size_t i, class T> ostream & print_tuple_utils(ostream &out, const T &tup) { if constexpr(i == tuple_size<T>::value) return out << ")"; else return print_tuple_utils<i + 1, T>(out << (i ? ", " : "(") << get<i>(tup), tup); }
template <class ...U> print_op(tuple<U...>) { return print_tuple_utils<0, tuple<U...>>(out, u); }
template <class Con, class = decltype(begin(declval<Con>()))> typename enable_if <!is_same<Con, string>::value, ostream&>::type operator << (ostream &out, const Con &con) { out << '{'; for (__typeof(con.begin()) it = con.begin(); it != con.end(); ++it) out << (it == con.begin() ? "" : ", ") << *it; return out << '}'; }
// end of template
namespace {
}
int Declare() {
return 180;
}
pair <vector <int>, vector <int>> Anna(long long A) {
vector <int> sa, sb;
while (A) {
REP(t, 3) sa.push_back(A & 1);
A >>= 1;
}
REP(i, sa.size()) sb.push_back(!(i & 1));
return pair{sa, sb};
}
/*************************************
* author: marvinthang *
* created: 26.12.2023 15:40:10 *
*************************************/
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define left ___left
#define right ___right
#define TIME (1.0 * clock() / CLOCKS_PER_SEC)
#define MASK(i) (1LL << (i))
#define BIT(x, i) ((x) >> (i) & 1)
#define __builtin_popcount __builtin_popcountll
#define ALL(v) (v).begin(), (v).end()
#define REP(i, n) for (int i = 0, _n = (n); i < _n; ++i)
#define REPD(i, n) for (int i = (n); i-- > 0; )
#define FOR(i, a, b) for (int i = (a), _b = (b); i < _b; ++i)
#define FORD(i, b, a) for (int i = (b), _a = (a); --i >= _a; )
#define FORE(i, a, b) for (int i = (a), _b = (b); i <= _b; ++i)
#define FORDE(i, b, a) for (int i = (b), _a = (a); i >= _a; --i)
#define scan_op(...) istream & operator >> (istream &in, __VA_ARGS__ &u)
#define print_op(...) ostream & operator << (ostream &out, const __VA_ARGS__ &u)
#ifdef LOCAL
#include "debug.h"
#else
#define file(name) if (fopen(name".inp", "r")) { freopen(name".inp", "r", stdin); freopen(name".out", "w", stdout); }
#define DB(...) 23
#define db(...) 23
#define debug(...) 23
#endif
template <class U, class V> scan_op(pair <U, V>) { return in >> u.first >> u.second; }
template <class T> scan_op(vector <T>) { for (size_t i = 0; i < u.size(); ++i) in >> u[i]; return in; }
template <class U, class V> print_op(pair <U, V>) { return out << '(' << u.first << ", " << u.second << ')'; }
template <size_t i, class T> ostream & print_tuple_utils(ostream &out, const T &tup) { if constexpr(i == tuple_size<T>::value) return out << ")"; else return print_tuple_utils<i + 1, T>(out << (i ? ", " : "(") << get<i>(tup), tup); }
template <class ...U> print_op(tuple<U...>) { return print_tuple_utils<0, tuple<U...>>(out, u); }
template <class Con, class = decltype(begin(declval<Con>()))> typename enable_if <!is_same<Con, string>::value, ostream&>::type operator << (ostream &out, const Con &con) { out << '{'; for (__typeof(con.begin()) it = con.begin(); it != con.end(); ++it) out << (it == con.begin() ? "" : ", ") << *it; return out << '}'; }
// end of template
namespace {
}
long long Bruno(vector <int> u) {
long long res = 0;
int pref = 3 * u.size();
int bit = 0, last = u.size();
REP(i, u.size()) {
pref += u[i] ? 1 : -1;
if (pref % 3 < 2) {
if (pref / 3 != last) {
if (pref / 3 > last) res ^= MASK(bit);
last = pref / 3;
++bit;
}
}
}
return res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
788 KB |
Output is correct |
2 |
Correct |
16 ms |
1252 KB |
Output is correct |
3 |
Correct |
18 ms |
1420 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
788 KB |
Output is correct |
2 |
Correct |
16 ms |
1252 KB |
Output is correct |
3 |
Correct |
18 ms |
1420 KB |
Output is correct |
4 |
Correct |
30 ms |
1896 KB |
Output is correct |
5 |
Correct |
30 ms |
2280 KB |
Output is correct |
6 |
Correct |
31 ms |
1804 KB |
Output is correct |
7 |
Correct |
30 ms |
1708 KB |
Output is correct |
8 |
Correct |
30 ms |
1912 KB |
Output is correct |
9 |
Correct |
31 ms |
1832 KB |
Output is correct |
10 |
Correct |
27 ms |
1812 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
788 KB |
Output is correct |
2 |
Correct |
16 ms |
1252 KB |
Output is correct |
3 |
Correct |
18 ms |
1420 KB |
Output is correct |
4 |
Correct |
30 ms |
1896 KB |
Output is correct |
5 |
Correct |
30 ms |
2280 KB |
Output is correct |
6 |
Correct |
31 ms |
1804 KB |
Output is correct |
7 |
Correct |
30 ms |
1708 KB |
Output is correct |
8 |
Correct |
30 ms |
1912 KB |
Output is correct |
9 |
Correct |
31 ms |
1832 KB |
Output is correct |
10 |
Correct |
27 ms |
1812 KB |
Output is correct |
11 |
Correct |
31 ms |
1896 KB |
Output is correct |
12 |
Correct |
30 ms |
1940 KB |
Output is correct |
13 |
Correct |
31 ms |
1832 KB |
Output is correct |
14 |
Correct |
31 ms |
1828 KB |
Output is correct |
15 |
Correct |
32 ms |
1800 KB |
Output is correct |
16 |
Correct |
31 ms |
2104 KB |
Output is correct |
17 |
Correct |
30 ms |
1744 KB |
Output is correct |
18 |
Correct |
27 ms |
1800 KB |
Output is correct |
19 |
Correct |
27 ms |
1792 KB |
Output is correct |
20 |
Correct |
27 ms |
1768 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
788 KB |
Output is correct |
2 |
Correct |
16 ms |
1252 KB |
Output is correct |
3 |
Correct |
18 ms |
1420 KB |
Output is correct |
4 |
Correct |
30 ms |
1896 KB |
Output is correct |
5 |
Correct |
30 ms |
2280 KB |
Output is correct |
6 |
Correct |
31 ms |
1804 KB |
Output is correct |
7 |
Correct |
30 ms |
1708 KB |
Output is correct |
8 |
Correct |
30 ms |
1912 KB |
Output is correct |
9 |
Correct |
31 ms |
1832 KB |
Output is correct |
10 |
Correct |
27 ms |
1812 KB |
Output is correct |
11 |
Correct |
31 ms |
1896 KB |
Output is correct |
12 |
Correct |
30 ms |
1940 KB |
Output is correct |
13 |
Correct |
31 ms |
1832 KB |
Output is correct |
14 |
Correct |
31 ms |
1828 KB |
Output is correct |
15 |
Correct |
32 ms |
1800 KB |
Output is correct |
16 |
Correct |
31 ms |
2104 KB |
Output is correct |
17 |
Correct |
30 ms |
1744 KB |
Output is correct |
18 |
Correct |
27 ms |
1800 KB |
Output is correct |
19 |
Correct |
27 ms |
1792 KB |
Output is correct |
20 |
Correct |
27 ms |
1768 KB |
Output is correct |
21 |
Correct |
34 ms |
2112 KB |
Output is correct |
22 |
Correct |
34 ms |
2120 KB |
Output is correct |
23 |
Correct |
36 ms |
2032 KB |
Output is correct |
24 |
Correct |
34 ms |
2120 KB |
Output is correct |
25 |
Correct |
34 ms |
2120 KB |
Output is correct |
26 |
Correct |
34 ms |
2240 KB |
Output is correct |
27 |
Correct |
32 ms |
2200 KB |
Output is correct |
28 |
Correct |
32 ms |
1800 KB |
Output is correct |
29 |
Correct |
34 ms |
1828 KB |
Output is correct |
30 |
Correct |
32 ms |
1804 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
788 KB |
Output is correct |
2 |
Correct |
16 ms |
1252 KB |
Output is correct |
3 |
Correct |
18 ms |
1420 KB |
Output is correct |
4 |
Correct |
30 ms |
1896 KB |
Output is correct |
5 |
Correct |
30 ms |
2280 KB |
Output is correct |
6 |
Correct |
31 ms |
1804 KB |
Output is correct |
7 |
Correct |
30 ms |
1708 KB |
Output is correct |
8 |
Correct |
30 ms |
1912 KB |
Output is correct |
9 |
Correct |
31 ms |
1832 KB |
Output is correct |
10 |
Correct |
27 ms |
1812 KB |
Output is correct |
11 |
Correct |
31 ms |
1896 KB |
Output is correct |
12 |
Correct |
30 ms |
1940 KB |
Output is correct |
13 |
Correct |
31 ms |
1832 KB |
Output is correct |
14 |
Correct |
31 ms |
1828 KB |
Output is correct |
15 |
Correct |
32 ms |
1800 KB |
Output is correct |
16 |
Correct |
31 ms |
2104 KB |
Output is correct |
17 |
Correct |
30 ms |
1744 KB |
Output is correct |
18 |
Correct |
27 ms |
1800 KB |
Output is correct |
19 |
Correct |
27 ms |
1792 KB |
Output is correct |
20 |
Correct |
27 ms |
1768 KB |
Output is correct |
21 |
Correct |
34 ms |
2112 KB |
Output is correct |
22 |
Correct |
34 ms |
2120 KB |
Output is correct |
23 |
Correct |
36 ms |
2032 KB |
Output is correct |
24 |
Correct |
34 ms |
2120 KB |
Output is correct |
25 |
Correct |
34 ms |
2120 KB |
Output is correct |
26 |
Correct |
34 ms |
2240 KB |
Output is correct |
27 |
Correct |
32 ms |
2200 KB |
Output is correct |
28 |
Correct |
32 ms |
1800 KB |
Output is correct |
29 |
Correct |
34 ms |
1828 KB |
Output is correct |
30 |
Correct |
32 ms |
1804 KB |
Output is correct |
31 |
Correct |
45 ms |
2516 KB |
Output is correct |
32 |
Correct |
49 ms |
2948 KB |
Output is correct |
33 |
Correct |
45 ms |
2748 KB |
Output is correct |
34 |
Correct |
45 ms |
2588 KB |
Output is correct |
35 |
Correct |
45 ms |
2580 KB |
Output is correct |
36 |
Correct |
44 ms |
2488 KB |
Output is correct |
37 |
Correct |
41 ms |
2444 KB |
Output is correct |
38 |
Correct |
40 ms |
2656 KB |
Output is correct |
39 |
Correct |
44 ms |
2424 KB |
Output is correct |
40 |
Correct |
41 ms |
2456 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
71 ms |
3420 KB |
Output is partially correct |
2 |
Partially correct |
76 ms |
3516 KB |
Output is partially correct |
3 |
Partially correct |
70 ms |
3548 KB |
Output is partially correct |
4 |
Partially correct |
70 ms |
3548 KB |
Output is partially correct |
5 |
Partially correct |
70 ms |
3536 KB |
Output is partially correct |
6 |
Partially correct |
70 ms |
3548 KB |
Output is partially correct |
7 |
Partially correct |
70 ms |
3524 KB |
Output is partially correct |
8 |
Partially correct |
70 ms |
3640 KB |
Output is partially correct |
9 |
Partially correct |
69 ms |
3532 KB |
Output is partially correct |
10 |
Partially correct |
69 ms |
3464 KB |
Output is partially correct |
11 |
Partially correct |
70 ms |
3456 KB |
Output is partially correct |
12 |
Partially correct |
70 ms |
3612 KB |
Output is partially correct |
13 |
Partially correct |
68 ms |
3816 KB |
Output is partially correct |
14 |
Partially correct |
64 ms |
3484 KB |
Output is partially correct |
15 |
Partially correct |
66 ms |
3380 KB |
Output is partially correct |
16 |
Partially correct |
63 ms |
3544 KB |
Output is partially correct |
17 |
Partially correct |
62 ms |
3192 KB |
Output is partially correct |
18 |
Partially correct |
63 ms |
3396 KB |
Output is partially correct |
19 |
Partially correct |
62 ms |
3380 KB |
Output is partially correct |
20 |
Partially correct |
65 ms |
3476 KB |
Output is partially correct |