Submission #893009

# Submission time Handle Problem Language Result Execution time Memory
893009 2023-12-26T10:17:48 Z marvinthang Broken Device 2 (JOI22_device2) C++17
55 / 100
73 ms 3836 KB
/*************************************
*    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 2000;
}

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 2 ms 796 KB Output is correct
2 Correct 16 ms 1164 KB Output is correct
3 Correct 18 ms 1436 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 796 KB Output is correct
2 Correct 16 ms 1164 KB Output is correct
3 Correct 18 ms 1436 KB Output is correct
4 Correct 30 ms 1876 KB Output is correct
5 Correct 30 ms 1812 KB Output is correct
6 Correct 30 ms 1888 KB Output is correct
7 Correct 30 ms 2204 KB Output is correct
8 Correct 30 ms 1812 KB Output is correct
9 Correct 28 ms 1816 KB Output is correct
10 Correct 27 ms 1772 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 796 KB Output is correct
2 Correct 16 ms 1164 KB Output is correct
3 Correct 18 ms 1436 KB Output is correct
4 Correct 30 ms 1876 KB Output is correct
5 Correct 30 ms 1812 KB Output is correct
6 Correct 30 ms 1888 KB Output is correct
7 Correct 30 ms 2204 KB Output is correct
8 Correct 30 ms 1812 KB Output is correct
9 Correct 28 ms 1816 KB Output is correct
10 Correct 27 ms 1772 KB Output is correct
11 Correct 31 ms 1924 KB Output is correct
12 Correct 31 ms 1832 KB Output is correct
13 Correct 32 ms 1916 KB Output is correct
14 Correct 30 ms 1836 KB Output is correct
15 Correct 31 ms 1832 KB Output is correct
16 Correct 31 ms 2024 KB Output is correct
17 Correct 29 ms 1828 KB Output is correct
18 Correct 32 ms 1656 KB Output is correct
19 Correct 27 ms 1684 KB Output is correct
20 Correct 27 ms 1772 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 796 KB Output is correct
2 Correct 16 ms 1164 KB Output is correct
3 Correct 18 ms 1436 KB Output is correct
4 Correct 30 ms 1876 KB Output is correct
5 Correct 30 ms 1812 KB Output is correct
6 Correct 30 ms 1888 KB Output is correct
7 Correct 30 ms 2204 KB Output is correct
8 Correct 30 ms 1812 KB Output is correct
9 Correct 28 ms 1816 KB Output is correct
10 Correct 27 ms 1772 KB Output is correct
11 Correct 31 ms 1924 KB Output is correct
12 Correct 31 ms 1832 KB Output is correct
13 Correct 32 ms 1916 KB Output is correct
14 Correct 30 ms 1836 KB Output is correct
15 Correct 31 ms 1832 KB Output is correct
16 Correct 31 ms 2024 KB Output is correct
17 Correct 29 ms 1828 KB Output is correct
18 Correct 32 ms 1656 KB Output is correct
19 Correct 27 ms 1684 KB Output is correct
20 Correct 27 ms 1772 KB Output is correct
21 Correct 34 ms 2052 KB Output is correct
22 Correct 34 ms 2140 KB Output is correct
23 Correct 37 ms 2128 KB Output is correct
24 Correct 34 ms 2196 KB Output is correct
25 Correct 34 ms 2108 KB Output is correct
26 Correct 34 ms 2196 KB Output is correct
27 Correct 33 ms 2148 KB Output is correct
28 Correct 31 ms 1836 KB Output is correct
29 Correct 31 ms 1844 KB Output is correct
30 Correct 32 ms 1928 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 796 KB Output is correct
2 Correct 16 ms 1164 KB Output is correct
3 Correct 18 ms 1436 KB Output is correct
4 Correct 30 ms 1876 KB Output is correct
5 Correct 30 ms 1812 KB Output is correct
6 Correct 30 ms 1888 KB Output is correct
7 Correct 30 ms 2204 KB Output is correct
8 Correct 30 ms 1812 KB Output is correct
9 Correct 28 ms 1816 KB Output is correct
10 Correct 27 ms 1772 KB Output is correct
11 Correct 31 ms 1924 KB Output is correct
12 Correct 31 ms 1832 KB Output is correct
13 Correct 32 ms 1916 KB Output is correct
14 Correct 30 ms 1836 KB Output is correct
15 Correct 31 ms 1832 KB Output is correct
16 Correct 31 ms 2024 KB Output is correct
17 Correct 29 ms 1828 KB Output is correct
18 Correct 32 ms 1656 KB Output is correct
19 Correct 27 ms 1684 KB Output is correct
20 Correct 27 ms 1772 KB Output is correct
21 Correct 34 ms 2052 KB Output is correct
22 Correct 34 ms 2140 KB Output is correct
23 Correct 37 ms 2128 KB Output is correct
24 Correct 34 ms 2196 KB Output is correct
25 Correct 34 ms 2108 KB Output is correct
26 Correct 34 ms 2196 KB Output is correct
27 Correct 33 ms 2148 KB Output is correct
28 Correct 31 ms 1836 KB Output is correct
29 Correct 31 ms 1844 KB Output is correct
30 Correct 32 ms 1928 KB Output is correct
31 Correct 45 ms 2508 KB Output is correct
32 Correct 45 ms 2484 KB Output is correct
33 Correct 45 ms 2564 KB Output is correct
34 Correct 49 ms 2760 KB Output is correct
35 Correct 45 ms 2444 KB Output is correct
36 Correct 44 ms 2388 KB Output is correct
37 Correct 41 ms 2528 KB Output is correct
38 Correct 41 ms 2252 KB Output is correct
39 Correct 41 ms 2432 KB Output is correct
40 Correct 41 ms 2304 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 69 ms 3484 KB Output is partially correct
2 Partially correct 71 ms 3772 KB Output is partially correct
3 Partially correct 69 ms 3688 KB Output is partially correct
4 Partially correct 73 ms 3488 KB Output is partially correct
5 Partially correct 70 ms 3772 KB Output is partially correct
6 Partially correct 70 ms 3472 KB Output is partially correct
7 Partially correct 70 ms 3488 KB Output is partially correct
8 Partially correct 69 ms 3612 KB Output is partially correct
9 Partially correct 69 ms 3476 KB Output is partially correct
10 Partially correct 68 ms 3572 KB Output is partially correct
11 Partially correct 70 ms 3592 KB Output is partially correct
12 Partially correct 70 ms 3600 KB Output is partially correct
13 Partially correct 68 ms 3836 KB Output is partially correct
14 Partially correct 68 ms 3556 KB Output is partially correct
15 Partially correct 64 ms 3512 KB Output is partially correct
16 Partially correct 63 ms 3252 KB Output is partially correct
17 Partially correct 63 ms 3396 KB Output is partially correct
18 Partially correct 66 ms 3400 KB Output is partially correct
19 Partially correct 65 ms 3464 KB Output is partially correct
20 Partially correct 63 ms 3512 KB Output is partially correct