Submission #1041464

# Submission time Handle Problem Language Result Execution time Memory
1041464 2024-08-02T04:17:02 Z 제우스 (BOJ 30318)(#11052) A Light Inconvenience (CEOI23_light) C++17
5 / 100
309 ms 596 KB
#include "light.h"
#include <bits/stdc++.h>
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define cr(v, n) (v).clear(), (v).resize(n);
using namespace std;
using lint = long long;
using pi = array<lint, 2>;

int cnt;
vector<lint> prevs = {1};

void prepare() { cnt = 0; }

lint match(vector<lint> &a, vector<lint> &b) {
	int j = 0;
	lint ans = 0;
	for (int i = 0; i < sz(b); i++) {
		while (j < sz(a) && a[j] <= b[i])
			j++;
		ans = max(ans, b[i] - a[j - 1]);
	}
	return ans;
}

pair<long long, vector<long long>> join(long long p) {
	lint stp = p + prevs.back();
	vector<lint> nexts = {stp};
	for (int i = 0; (1ll << i) < stp; i++) {
		nexts.push_back(stp - (1ll << i));
	}
	if (nexts.back() > 1)
		nexts.push_back(1);
	sort(all(nexts));
	auto ans = make_pair(match(prevs, nexts), nexts);
	prevs = nexts;
	return ans;
}

pair<long long, vector<long long>> leave(long long p) {
	lint stp = -p + prevs.back();
	vector<lint> nexts = {stp};
	for (int i = 0; (1ll << i) < stp; i++) {
		nexts.push_back(stp - (1ll << i));
	}
	if (nexts.back() > 1)
		nexts.push_back(1);
	sort(all(nexts));
	auto ans = make_pair(match(prevs, nexts), nexts);
	prevs = nexts;
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 596 KB Correct
2 Correct 258 ms 424 KB Correct
3 Correct 294 ms 420 KB Correct
4 Correct 292 ms 440 KB Output is correct
5 Correct 307 ms 420 KB Correct
6 Correct 300 ms 420 KB Correct
7 Correct 309 ms 420 KB Correct
8 Correct 281 ms 440 KB Output is correct
9 Correct 277 ms 444 KB Output is correct
10 Correct 298 ms 424 KB Output is correct
11 Correct 271 ms 344 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Incorrect 0 ms 344 KB Not correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Incorrect 0 ms 344 KB Not correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Incorrect 0 ms 344 KB Not correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Incorrect 0 ms 344 KB Not correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Incorrect 0 ms 344 KB Not correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 283 ms 416 KB Correct
3 Correct 284 ms 420 KB Correct
4 Partially correct 286 ms 420 KB Partially correct
5 Correct 303 ms 444 KB Correct
6 Correct 279 ms 416 KB Correct
7 Correct 297 ms 416 KB Correct
8 Partially correct 272 ms 424 KB Partially correct
9 Partially correct 288 ms 440 KB Partially correct
10 Partially correct 271 ms 432 KB Partially correct
11 Correct 267 ms 344 KB Correct
12 Incorrect 0 ms 344 KB Not correct
13 Halted 0 ms 0 KB -