Submission #1040696

# Submission time Handle Problem Language Result Execution time Memory
1040696 2024-08-01T08:32:36 Z qwerasdfzxcl A Light Inconvenience (CEOI23_light) C++17
0 / 100
282 ms 600 KB
#include "light.h"
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

ll n;
vector<ll> a;

void prepare(){
	n = 1;
	a.push_back(1);
}

vector<ll> rev(vector<ll> v){
	reverse(v.begin(), v.end());
	return v;
}

std::pair<long long, std::vector<long long>> join(long long p){
	n += p;
	for (auto &x:a) x += p;

	while(a.size() > 1){
		ll t = a.back() - 1 - (n - a.back() + 1);
		if (t <= 1) a.pop_back();
		else break;
	}

	while(true){
		ll t = a.back() - 1 - (n - a.back() + 1);
		if (t <= 1) break;
		a.push_back(t);
	}

	a.push_back(1);
	return {p, rev(a)};
}

std::pair<long long, std::vector<long long>> leave(long long p){
	n -= p;
	vector<ll> b;
	for (auto &x:a) if (x <= n) b.push_back(x);

	a.clear();
	a.push_back(n);
	
	while(true){
		ll t = a.back() - 1 - (n - a.back() + 1);
		if (t <= 1) break;
		ll mn = 4e18;
		for (auto &x:b) if (x + p >= t) mn = min(mn, max(t, x));
		assert(mn < a.back());
		a.push_back(mn);
	}

	a.push_back(1);
	return {p, rev(a)};

}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 257 ms 428 KB Correct
3 Correct 251 ms 344 KB Correct
4 Correct 282 ms 424 KB Correct
5 Correct 225 ms 344 KB Correct
6 Correct 230 ms 504 KB Correct
7 Correct 252 ms 344 KB Correct
8 Correct 230 ms 600 KB Correct
9 Correct 247 ms 344 KB Correct
10 Correct 230 ms 344 KB Correct
11 Incorrect 192 ms 344 KB Not correct
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Correct
2 Incorrect 12 ms 344 KB Not correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Correct
2 Incorrect 12 ms 344 KB Not correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Correct
2 Incorrect 12 ms 344 KB Not correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Correct
2 Incorrect 12 ms 344 KB Not correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Correct
2 Incorrect 12 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 223 ms 344 KB Correct
3 Correct 249 ms 344 KB Correct
4 Correct 267 ms 344 KB Correct
5 Correct 261 ms 344 KB Correct
6 Correct 216 ms 344 KB Correct
7 Correct 273 ms 596 KB Correct
8 Correct 241 ms 344 KB Correct
9 Correct 228 ms 596 KB Correct
10 Correct 245 ms 344 KB Correct
11 Incorrect 151 ms 344 KB Not correct
12 Halted 0 ms 0 KB -