Submission #547772

#TimeUsernameProblemLanguageResultExecution timeMemory
547772skittles1412Broken Device 2 (JOI22_device2)C++17
80 / 100
98 ms3604 KiB
#include "Anna.h"
#include "bits/extc++.h"

using namespace std;

template <typename T>
void dbgh(const T& t) {
	cerr << t << endl;
}

template <typename T, typename... U>
void dbgh(const T& t, const U&... u) {
	cerr << t << " | ";
	dbgh(u...);
}

#ifdef DEBUG
#define dbg(...)                                           \
	cerr << "L" << __LINE__ << " [" << #__VA_ARGS__ << "]" \
		 << ": ";                                          \
	dbgh(__VA_ARGS__)
#else
#define cerr   \
	if (false) \
	cerr
#define dbg(...)
#endif

using ll = long long;

#define endl "\n"
#define long int64_t
#define sz(x) int((x).size())

int Declare() {
	return 180;
}

pair<vector<int>, vector<int>> Anna(ll x) {
	vector<int> a;
	for (int i = 0; i < 90; i++) {
		a.push_back(0);
		a.push_back(1);
	}
	vector<int> b;
	for (int i = 59; i >= 0; i--) {
		for (int j = 0; j < 3; j++) {
			b.push_back(int((x >> i) & 1));
		}
	}
	return {a, b};
}
#include "Anna.h"
#include "bits/extc++.h"

using namespace std;

template <typename T>
void dbgh(const T& t) {
	cerr << t << endl;
}

template <typename T, typename... U>
void dbgh(const T& t, const U&... u) {
	cerr << t << " | ";
	dbgh(u...);
}

#ifdef DEBUG
#define dbg(...)                                           \
	cerr << "L" << __LINE__ << " [" << #__VA_ARGS__ << "]" \
		 << ": ";                                          \
	dbgh(__VA_ARGS__)
#else
#define cerr   \
	if (false) \
	cerr
#define dbg(...)
#endif

using ll = long long;

#define endl "\n"
#define long int64_t
#define sz(x) int((x).size())

ll Bruno(vector<int> arr) {
	ll ans = 0;
	int cur = 0, psum = 0;
	for (auto& a : arr) {
		psum += a * 2 - 1;
		dbg(psum, a, cur);
		if (psum == cur + 2) {
			ans <<= 1;
			ans |= 1;
			cur += 3;
			dbg(1);
		} else if (psum == cur - 3) {
			ans <<= 1;
			cur -= 3;
			dbg(0);
		}
	}
	dbg(ans);
	return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...