Submission #562457

# Submission time Handle Problem Language Result Execution time Memory
562457 2022-05-14T12:13:23 Z DanShaders Broken Device 2 (JOI22_device2) C++17
68 / 100
310 ms 10340 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;

int Declare() {
	return 600;
}

pair<vector<int>, vector<int>> Anna(ll n) {
	vector<int> x;
	for (int i = 0; i < 300; ++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) < 600) {
		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);
		}
	}
	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;

int Declare() {
	return 600;
}

pair<vector<int>, vector<int>> Anna(ll n) {
	vector<int> x;
	for (int i = 0; i < 300; ++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) < 600) {
		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);
		}
	}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 648 KB Output is correct
2 Correct 258 ms 10160 KB Output is correct
3 Correct 256 ms 10104 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 648 KB Output is correct
2 Correct 258 ms 10160 KB Output is correct
3 Correct 256 ms 10104 KB Output is correct
4 Correct 252 ms 10168 KB Output is correct
5 Correct 257 ms 10208 KB Output is correct
6 Correct 310 ms 10264 KB Output is correct
7 Correct 258 ms 10180 KB Output is correct
8 Correct 251 ms 10236 KB Output is correct
9 Correct 259 ms 10164 KB Output is correct
10 Correct 247 ms 10224 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 648 KB Output is correct
2 Correct 258 ms 10160 KB Output is correct
3 Correct 256 ms 10104 KB Output is correct
4 Correct 252 ms 10168 KB Output is correct
5 Correct 257 ms 10208 KB Output is correct
6 Correct 310 ms 10264 KB Output is correct
7 Correct 258 ms 10180 KB Output is correct
8 Correct 251 ms 10236 KB Output is correct
9 Correct 259 ms 10164 KB Output is correct
10 Correct 247 ms 10224 KB Output is correct
11 Correct 257 ms 10140 KB Output is correct
12 Correct 276 ms 10272 KB Output is correct
13 Correct 261 ms 10124 KB Output is correct
14 Correct 266 ms 10172 KB Output is correct
15 Correct 256 ms 10316 KB Output is correct
16 Correct 245 ms 10128 KB Output is correct
17 Correct 279 ms 10152 KB Output is correct
18 Correct 244 ms 10108 KB Output is correct
19 Correct 267 ms 10208 KB Output is correct
20 Correct 245 ms 10212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 648 KB Output is correct
2 Correct 258 ms 10160 KB Output is correct
3 Correct 256 ms 10104 KB Output is correct
4 Correct 252 ms 10168 KB Output is correct
5 Correct 257 ms 10208 KB Output is correct
6 Correct 310 ms 10264 KB Output is correct
7 Correct 258 ms 10180 KB Output is correct
8 Correct 251 ms 10236 KB Output is correct
9 Correct 259 ms 10164 KB Output is correct
10 Correct 247 ms 10224 KB Output is correct
11 Correct 257 ms 10140 KB Output is correct
12 Correct 276 ms 10272 KB Output is correct
13 Correct 261 ms 10124 KB Output is correct
14 Correct 266 ms 10172 KB Output is correct
15 Correct 256 ms 10316 KB Output is correct
16 Correct 245 ms 10128 KB Output is correct
17 Correct 279 ms 10152 KB Output is correct
18 Correct 244 ms 10108 KB Output is correct
19 Correct 267 ms 10208 KB Output is correct
20 Correct 245 ms 10212 KB Output is correct
21 Correct 286 ms 10140 KB Output is correct
22 Correct 248 ms 10228 KB Output is correct
23 Correct 277 ms 10108 KB Output is correct
24 Correct 247 ms 10304 KB Output is correct
25 Correct 276 ms 10160 KB Output is correct
26 Correct 238 ms 10192 KB Output is correct
27 Correct 253 ms 10164 KB Output is correct
28 Correct 258 ms 10028 KB Output is correct
29 Correct 249 ms 10076 KB Output is correct
30 Correct 255 ms 10056 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 648 KB Output is correct
2 Correct 258 ms 10160 KB Output is correct
3 Correct 256 ms 10104 KB Output is correct
4 Correct 252 ms 10168 KB Output is correct
5 Correct 257 ms 10208 KB Output is correct
6 Correct 310 ms 10264 KB Output is correct
7 Correct 258 ms 10180 KB Output is correct
8 Correct 251 ms 10236 KB Output is correct
9 Correct 259 ms 10164 KB Output is correct
10 Correct 247 ms 10224 KB Output is correct
11 Correct 257 ms 10140 KB Output is correct
12 Correct 276 ms 10272 KB Output is correct
13 Correct 261 ms 10124 KB Output is correct
14 Correct 266 ms 10172 KB Output is correct
15 Correct 256 ms 10316 KB Output is correct
16 Correct 245 ms 10128 KB Output is correct
17 Correct 279 ms 10152 KB Output is correct
18 Correct 244 ms 10108 KB Output is correct
19 Correct 267 ms 10208 KB Output is correct
20 Correct 245 ms 10212 KB Output is correct
21 Correct 286 ms 10140 KB Output is correct
22 Correct 248 ms 10228 KB Output is correct
23 Correct 277 ms 10108 KB Output is correct
24 Correct 247 ms 10304 KB Output is correct
25 Correct 276 ms 10160 KB Output is correct
26 Correct 238 ms 10192 KB Output is correct
27 Correct 253 ms 10164 KB Output is correct
28 Correct 258 ms 10028 KB Output is correct
29 Correct 249 ms 10076 KB Output is correct
30 Correct 255 ms 10056 KB Output is correct
31 Correct 262 ms 10172 KB Output is correct
32 Correct 250 ms 10184 KB Output is correct
33 Correct 261 ms 10068 KB Output is correct
34 Correct 239 ms 10212 KB Output is correct
35 Correct 269 ms 10176 KB Output is correct
36 Correct 237 ms 10160 KB Output is correct
37 Correct 257 ms 10288 KB Output is correct
38 Correct 242 ms 10280 KB Output is correct
39 Correct 275 ms 10132 KB Output is correct
40 Correct 245 ms 10176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 273 ms 10100 KB Output is partially correct
2 Partially correct 248 ms 10252 KB Output is partially correct
3 Partially correct 281 ms 10248 KB Output is partially correct
4 Partially correct 242 ms 10096 KB Output is partially correct
5 Partially correct 298 ms 10244 KB Output is partially correct
6 Partially correct 244 ms 10052 KB Output is partially correct
7 Partially correct 274 ms 10320 KB Output is partially correct
8 Partially correct 242 ms 10168 KB Output is partially correct
9 Partially correct 260 ms 10124 KB Output is partially correct
10 Partially correct 244 ms 10168 KB Output is partially correct
11 Partially correct 255 ms 10200 KB Output is partially correct
12 Partially correct 269 ms 10288 KB Output is partially correct
13 Partially correct 267 ms 10276 KB Output is partially correct
14 Partially correct 236 ms 10212 KB Output is partially correct
15 Partially correct 288 ms 10208 KB Output is partially correct
16 Partially correct 245 ms 10260 KB Output is partially correct
17 Partially correct 263 ms 10340 KB Output is partially correct
18 Partially correct 255 ms 10128 KB Output is partially correct
19 Partially correct 254 ms 10032 KB Output is partially correct
20 Partially correct 253 ms 10240 KB Output is partially correct