Submission #562461

# Submission time Handle Problem Language Result Execution time Memory
562461 2022-05-14T12:17:22 Z DanShaders Broken Device 2 (JOI22_device2) C++17
5 / 100
226 ms 8896 KB
//bs:flags:grader.cpp
#include "Anna.h"
#include "Bruno.h"

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;

namespace x = __gnu_pbds;
template <typename T>
using ordered_set = x::tree<T, x::null_type, less<T>, x::rb_tree_tag, x::tree_order_statistics_node_update>;

template <typename T>
using normal_queue = priority_queue<T, vector<T>, greater<>>;

#define all(x) begin(x), end(x)
#define sz(x) ((int) (x).size())
#define x first
#define y second
using ll = long long;
using ld = long double;

const ll MAGIC = 960389134456460687;

int Declare() {
	return 520;
}

pair<vector<int>, vector<int>> Anna(ll n) {
	n ^= MAGIC;
	vector<int> x;
	for (int i = 0; i < Declare() / 2; ++i) {
		x.push_back(1);
		x.push_back(0);
	}
	vector<int> y;
	for (int i = 0; i < 60; ++i) {
		y.push_back(1);
		y.push_back(1);
		y.push_back(1);
		if (n >> i & 1) {
			y.push_back(1);
			y.push_back(1);
			y.push_back(0);
			y.push_back(0);
		}
		y.push_back(0);
		y.push_back(0);
		y.push_back(0);
	}
	while (sz(y) < Declare()) {
		y.push_back(1);
		y.push_back(0);
	}
	return {x, y};
}

ll Bruno(vector<int> a) {
	int balance = 0, mx = 0;
	ll ans = 0;
	int i = 0;

	for (int u : a) {
		balance += (u == 0 ? -1 : 1);
		if (balance < 2) {
			if (mx >= 5) {
				ans |= 1ll << i;
				++i;
			} else if (mx >= 3) {
				++i;
			}
			mx = 0;
		} else {
			mx = max(mx, balance);
		}
	}
	ans ^= MAGIC;
	return ans;
}
//bs:flags:grader.cpp
#include "Anna.h"
#include "Bruno.h"

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;

namespace x = __gnu_pbds;
template <typename T>
using ordered_set = x::tree<T, x::null_type, less<T>, x::rb_tree_tag, x::tree_order_statistics_node_update>;

template <typename T>
using normal_queue = priority_queue<T, vector<T>, greater<>>;

#define all(x) begin(x), end(x)
#define sz(x) ((int) (x).size())
#define x first
#define y second
using ll = long long;
using ld = long double;

const ll MAGIC = 960389134456460687;

int Declare() {
	return 520;
}

pair<vector<int>, vector<int>> Anna(ll n) {
	n ^= MAGIC;
	vector<int> x;
	for (int i = 0; i < Declare() / 2; ++i) {
		x.push_back(1);
		x.push_back(0);
	}
	vector<int> y;
	for (int i = 0; i < 60; ++i) {
		y.push_back(1);
		y.push_back(1);
		y.push_back(1);
		if (n >> i & 1) {
			y.push_back(1);
			y.push_back(1);
			y.push_back(0);
			y.push_back(0);
		}
		y.push_back(0);
		y.push_back(0);
		y.push_back(0);
	}
	while (sz(y) < Declare()) {
		y.push_back(1);
		y.push_back(0);
	}
	return {x, y};
}

ll Bruno(vector<int> a) {
	int balance = 0, mx = 0;
	ll ans = 0;
	int i = 0;

	for (int u : a) {
		balance += (u == 0 ? -1 : 1);
		if (balance < 2) {
			if (mx >= 5) {
				ans |= 1ll << i;
				++i;
			} else if (mx >= 3) {
				++i;
			}
			mx = 0;
		} else {
			mx = max(mx, balance);
		}
	}
	ans ^= MAGIC;
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 648 KB Output is correct
2 Correct 225 ms 8896 KB Output is correct
3 Correct 226 ms 8864 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 648 KB Output is correct
2 Correct 225 ms 8896 KB Output is correct
3 Correct 226 ms 8864 KB Output is correct
4 Incorrect 29 ms 3312 KB Wrong Answer [4]
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 648 KB Output is correct
2 Correct 225 ms 8896 KB Output is correct
3 Correct 226 ms 8864 KB Output is correct
4 Incorrect 29 ms 3312 KB Wrong Answer [4]
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 648 KB Output is correct
2 Correct 225 ms 8896 KB Output is correct
3 Correct 226 ms 8864 KB Output is correct
4 Incorrect 29 ms 3312 KB Wrong Answer [4]
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 648 KB Output is correct
2 Correct 225 ms 8896 KB Output is correct
3 Correct 226 ms 8864 KB Output is correct
4 Incorrect 29 ms 3312 KB Wrong Answer [4]
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 764 KB Wrong Answer [4]
2 Halted 0 ms 0 KB -