답안 #1041829

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1041829 2024-08-02T08:36:07 Z 이종영(#11053) A Light Inconvenience (CEOI23_light) C++17
0 / 100
0 ms 432 KB
#include "light.h"
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
ll n;
vector<ll> V,R;
void prepare(){
	n=1;
	V.push_back(1);
}
std::pair<ll, std::vector<ll>> join(ll p){
	n+=p;
	while(V.size()>=3&&n<=V.end()[-2]+V.end()[-3]) V.pop_back();
	V.push_back(n);
	R=V;
	for(ll &x: R) x=n+1-x;
	reverse(R.begin(),R.end());
	assert(R.size()<=150);
	return {5*p,R};
}
std::pair<ll, std::vector<ll>> leave(ll p){
	n-=p;
	if(n==1){
		V=R={1};
		return {5*p,R};
	}
	if(n==2){
		V=R={1,2};
		return {5*p,R};
	}
	reverse(V.begin(),V.end());
	while(V.back()<=p) V.pop_back();
	for(ll &x: V) x-=p;
	V.push_back(1);
	V.push_back(2);
	V.push_back(n);
	reverse(V.begin(),V.end());
	sort(V.begin(),V.end());
	V.resize(unique(V.begin(),V.end())-V.begin());
	/*cout<<p<<": ";
	for(ll x: V) cout<<x<<" ";
	cout<<"\n";*/
	vector<ll> NV=V;
	V.clear();
	V.push_back(1);
	V.push_back(NV[0]);
	V.push_back(NV[1]);
	for(int i=2;i<(int)NV.size();i++){
		while(NV[i]>5*V.end()[-1]+V.end()[-3]){
			V.push_back(5*V.end()[-1]+V.end()[-3]);
		}
		//if(i+1<(int)NV.size()&&NV[i+1]<=5*V.end()[-1]+V.end()[-3]) continue;
		V.push_back(NV[i]);
	}
	reverse(V.begin(),V.end());
	V.pop_back();
	reverse(V.begin(),V.end());
	R=V;
	for(ll &x: R) x=n+1-x;
	reverse(R.begin(),R.end());
	assert(R.size()<=150);
	return {5*p,R};
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 432 KB Not correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Not correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Not correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Not correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Not correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Not correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 344 KB Partially correct
2 Incorrect 0 ms 344 KB Not correct
3 Halted 0 ms 0 KB -