Submission #1041467

# Submission time Handle Problem Language Result Execution time Memory
1041467 2024-08-02T04:21:49 Z 제우스 (BOJ 30318)(#11052) A Light Inconvenience (CEOI23_light) C++17
0 / 100
337 ms 684 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);
	assert(ans.first <= 5 * p);

	prevs = nexts;
	return ans;
}

pair<long long, vector<long long>> leave(long long p) {
	auto z = prevs;
	lint thr = prevs.back() - p;
	while (sz(prevs) && prevs.back() > thr) {
		prevs.pop_back();
	}
	vector<lint> nexts = prevs;
	if (prevs.back() < thr)
		nexts.push_back(thr);
	for (int i = 0; thr - (1ll << i) > prevs.back(); i++) {
		nexts.push_back(thr - (1ll << i));
	}
	sort(all(nexts));
	auto ans = make_pair(match(z, nexts), nexts);
	assert(ans.first <= 5 * p);
	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 344 KB Correct
2 Correct 315 ms 420 KB Correct
3 Correct 306 ms 444 KB Correct
4 Correct 299 ms 344 KB Correct
5 Correct 298 ms 424 KB Correct
6 Correct 337 ms 420 KB Correct
7 Correct 296 ms 416 KB Correct
8 Runtime error 123 ms 436 KB Execution killed with signal 6
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Runtime error 1 ms 596 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Runtime error 1 ms 596 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Runtime error 1 ms 596 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Runtime error 1 ms 596 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Runtime error 1 ms 596 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 310 ms 684 KB Correct
3 Correct 299 ms 420 KB Correct
4 Correct 283 ms 420 KB Correct
5 Correct 261 ms 428 KB Correct
6 Correct 274 ms 444 KB Correct
7 Correct 293 ms 420 KB Correct
8 Runtime error 132 ms 596 KB Execution killed with signal 6
9 Halted 0 ms 0 KB -