답안 #1063262

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1063262 2024-08-17T15:58:59 Z beaconmc Brought Down the Grading Server? (CEOI23_balance) C++14
컴파일 오류
0 ms 0 KB
#include "light.h"

#include <bits/stdc++.h>
 
typedef long long ll;
#define FOR(i,x,y) for(ll i=x; i<y; i++)
#define FORNEG(i,x,y) for(ll i=x; i>y; i--)
 
using namespace std;

ll n, maxi;
vector<ll> prevs;

void prepare(){
	n = 1;
	maxi = n;
	prevs = {1};
}

pair<long long, std::vector<long long>> join(long long p){
	n += p;

	set<ll> stuff;
	stuff.insert(1);
	stuff.insert(n);
	for (auto&i : prevs){
		if (i != 1) stuff.insert(i+p);
	}
	vector<ll> real;
	for (auto&i : stuff) if (1<=i && i<=n) real.push_back(i);


	vector<ll> spare;
	FORNEG(i, real.size()-1, 0){
		//cout << (n-real[i] + 1)  << " " << (real[i] - real[i-1] - 1) << endl;
		while ((n-real[i] + 1) < (real[i] - real[i-1] - 1)){
			spare.push_back(real[i]);
			real[i] = n - (n-real[i] + 1)*2;
		}
	}
	for (auto&i : spare) real.push_back(i);
	sort(real.begin(), real.end());


	vector<ll> realreal;
	for (auto&i : real){
		while (realreal.size() >= 2 && ((n-i + 1) >= (i - realreal[realreal.size()-2] - 1))){

			realreal.pop_back();
		}
		realreal.push_back(i);
	}
	
	prevs = realreal;
	return {p*5,realreal};

}

std::pair<long long, std::vector<long long>> leave(long long p){
	n -= p;

	set<ll> stuff;
	stuff.insert(1);
	stuff.insert(n);
	for (auto&i : prevs){
		if (i != 1) stuff.insert(i);
	}
	vector<ll> real;
	for (auto&i : stuff) if (1<=i && i<=n) real.push_back(i);


	vector<ll> spare;
	FORNEG(i, real.size()-1, 0){
		//cout << (n-real[i] + 1)  << " " << (real[i] - real[i-1] - 1) << endl;
		while ((n-real[i] + 1) < (real[i] - real[i-1] - 1)){
			spare.push_back(real[i]);
			real[i] = n - (n-real[i] + 1)*2;
		}
	}
	for (auto&i : spare) real.push_back(i);
	sort(real.begin(), real.end());


	vector<ll> realreal;
	for (auto&i : real){
		while (realreal.size() >= 2 && ((n-i + 1) >= (i - realreal[realreal.size()-2] - 1))){

			realreal.pop_back();
		}
		realreal.push_back(i);
	}
	
	prevs = realreal;
	return {p*5,realreal};


}



Compilation message

balance.cpp:1:10: fatal error: light.h: No such file or directory
    1 | #include "light.h"
      |          ^~~~~~~~~
compilation terminated.