Submission #1063189

# Submission time Handle Problem Language Result Execution time Memory
1063189 2024-08-17T15:01:43 Z beaconmc A Light Inconvenience (CEOI23_light) C++17
5 / 100
493 ms 600 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*5,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+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*5,real};



}



# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 420 ms 416 KB Output is correct
3 Correct 419 ms 592 KB Output is correct
4 Correct 435 ms 420 KB Output is correct
5 Correct 461 ms 592 KB Output is correct
6 Correct 444 ms 420 KB Output is correct
7 Correct 451 ms 416 KB Output is correct
8 Correct 460 ms 596 KB Output is correct
9 Correct 474 ms 420 KB Output is correct
10 Correct 441 ms 420 KB Output is correct
11 Correct 408 ms 416 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 57 ms 428 KB Output is correct
4 Incorrect 19 ms 600 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 57 ms 428 KB Output is correct
4 Incorrect 19 ms 600 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 57 ms 428 KB Output is correct
4 Incorrect 19 ms 600 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 57 ms 428 KB Output is correct
4 Incorrect 19 ms 600 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 57 ms 428 KB Output is correct
4 Incorrect 19 ms 600 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 440 ms 344 KB Partially correct
3 Partially correct 493 ms 420 KB Partially correct
4 Partially correct 449 ms 420 KB Partially correct
5 Partially correct 429 ms 440 KB Partially correct
6 Partially correct 479 ms 420 KB Partially correct
7 Partially correct 432 ms 416 KB Partially correct
8 Partially correct 457 ms 420 KB Partially correct
9 Partially correct 470 ms 592 KB Partially correct
10 Partially correct 426 ms 600 KB Partially correct
11 Partially correct 401 ms 416 KB Partially correct
12 Partially correct 297 ms 344 KB Partially correct
13 Partially correct 70 ms 344 KB Partially correct
14 Incorrect 19 ms 600 KB Not correct
15 Halted 0 ms 0 KB -