Submission #1063250

# Submission time Handle Problem Language Result Execution time Memory
1063250 2024-08-17T15:48:30 Z beaconmc A Light Inconvenience (CEOI23_light) C++17
5 / 100
475 ms 596 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());
	prevs = real;
	return {p*5,real};



}



# Verdict Execution time Memory Grader output
1 Correct 0 ms 596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 446 ms 428 KB Output is correct
3 Correct 475 ms 592 KB Output is correct
4 Correct 457 ms 436 KB Output is correct
5 Correct 472 ms 592 KB Output is correct
6 Correct 460 ms 592 KB Output is correct
7 Correct 464 ms 420 KB Output is correct
8 Correct 460 ms 344 KB Output is correct
9 Correct 453 ms 436 KB Output is correct
10 Correct 430 ms 344 KB Output is correct
11 Correct 417 ms 592 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 316 ms 344 KB Output is correct
3 Correct 78 ms 460 KB Output is correct
4 Incorrect 1 ms 344 KB Not correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 316 ms 344 KB Output is correct
3 Correct 78 ms 460 KB Output is correct
4 Incorrect 1 ms 344 KB Not correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 316 ms 344 KB Output is correct
3 Correct 78 ms 460 KB Output is correct
4 Incorrect 1 ms 344 KB Not correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 316 ms 344 KB Output is correct
3 Correct 78 ms 460 KB Output is correct
4 Incorrect 1 ms 344 KB Not correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 316 ms 344 KB Output is correct
3 Correct 78 ms 460 KB Output is correct
4 Incorrect 1 ms 344 KB Not correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 344 KB Partially correct
2 Partially correct 451 ms 344 KB Partially correct
3 Partially correct 450 ms 424 KB Partially correct
4 Partially correct 454 ms 344 KB Partially correct
5 Partially correct 473 ms 428 KB Partially correct
6 Partially correct 436 ms 344 KB Partially correct
7 Partially correct 456 ms 416 KB Partially correct
8 Partially correct 453 ms 344 KB Partially correct
9 Partially correct 472 ms 420 KB Partially correct
10 Partially correct 462 ms 344 KB Partially correct
11 Partially correct 404 ms 412 KB Partially correct
12 Partially correct 341 ms 344 KB Partially correct
13 Partially correct 80 ms 592 KB Partially correct
14 Incorrect 1 ms 344 KB Not correct
15 Halted 0 ms 0 KB -