답안 #1040710

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1040710 2024-08-01T08:39:48 Z qwerasdfzxcl A Light Inconvenience (CEOI23_light) C++17
0 / 100
512 ms 852 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;
	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);
	assert(a.size() <= 150);
	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);
	assert(a.size() <= 150);
	return {p, rev(a)};

}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 512 ms 344 KB Correct
3 Correct 451 ms 852 KB Correct
4 Correct 456 ms 344 KB Correct
5 Correct 467 ms 344 KB Correct
6 Correct 471 ms 344 KB Correct
7 Correct 488 ms 344 KB Correct
8 Correct 409 ms 596 KB Correct
9 Correct 445 ms 344 KB Correct
10 Correct 478 ms 344 KB Correct
11 Incorrect 304 ms 344 KB Not correct
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct
2 Incorrect 10 ms 344 KB Not correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct
2 Incorrect 10 ms 344 KB Not correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct
2 Incorrect 10 ms 344 KB Not correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct
2 Incorrect 10 ms 344 KB Not correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Correct
2 Incorrect 10 ms 344 KB Not correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Correct
2 Correct 453 ms 344 KB Correct
3 Correct 460 ms 344 KB Correct
4 Correct 458 ms 344 KB Correct
5 Correct 447 ms 344 KB Correct
6 Correct 455 ms 344 KB Correct
7 Correct 464 ms 344 KB Correct
8 Correct 439 ms 344 KB Correct
9 Correct 427 ms 344 KB Correct
10 Correct 483 ms 504 KB Correct
11 Incorrect 297 ms 344 KB Not correct
12 Halted 0 ms 0 KB -