Submission #1063242

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

}

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,real};



}



# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Correct
2 Correct 480 ms 428 KB Correct
3 Correct 431 ms 424 KB Correct
4 Correct 436 ms 344 KB Correct
5 Correct 457 ms 416 KB Correct
6 Correct 433 ms 596 KB Correct
7 Correct 444 ms 416 KB Correct
8 Correct 412 ms 344 KB Correct
9 Correct 448 ms 592 KB Correct
10 Correct 442 ms 424 KB Correct
11 Correct 415 ms 412 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 291 ms 344 KB Correct
3 Correct 74 ms 344 KB 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 Correct
2 Correct 291 ms 344 KB Correct
3 Correct 74 ms 344 KB 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 Correct
2 Correct 291 ms 344 KB Correct
3 Correct 74 ms 344 KB 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 Correct
2 Correct 291 ms 344 KB Correct
3 Correct 74 ms 344 KB 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 Correct
2 Correct 291 ms 344 KB Correct
3 Correct 74 ms 344 KB 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 Correct
2 Correct 438 ms 344 KB Correct
3 Correct 476 ms 592 KB Correct
4 Correct 435 ms 344 KB Correct
5 Correct 419 ms 592 KB Correct
6 Correct 438 ms 416 KB Correct
7 Correct 442 ms 416 KB Correct
8 Correct 460 ms 424 KB Correct
9 Correct 440 ms 424 KB Correct
10 Correct 418 ms 592 KB Correct
11 Correct 402 ms 416 KB Correct
12 Correct 336 ms 344 KB Correct
13 Correct 74 ms 460 KB Correct
14 Incorrect 1 ms 344 KB Not correct
15 Halted 0 ms 0 KB -