Submission #1073339

# Submission time Handle Problem Language Result Execution time Memory
1073339 2024-08-24T12:43:51 Z Abito A Light Inconvenience (CEOI23_light) C++17
0 / 100
366 ms 596 KB
#include "light.h"
#include <bits/stdc++.h>
#define pb push_back
#define int long long
#define ep insert
using namespace std;
set<int> s;
int n;
void prepare(){
	n=1;
	s.ep(1);
}
 
std::pair<long long, std::vector<long long>> join(long long x){
	n+=x;
	set<int> z;
	for (auto u:s) z.ep(u+x);
	s.clear();
	s.ep(1);
	for (int i=1;i<=n;){
		int j=n+1;
		auto it=z.upper_bound(i);
		if (it!=z.end() && *it<=2*i) j=*it;
		it=z.upper_bound(2*i);
		if (it!=z.end() && *it<=2*i+x) j=2*i;
		if (j!=n+1)s.ep(j);
		i=j;
	}
	vector<int> v;
	for (auto u:s) v.pb(n-u+1);
	sort(v.begin(),v.end());
	return {x,v};
}
 
std::pair<long long, std::vector<long long>> leave(long long x){
	n-=x;
	set<int> z;
	for (auto u:s) if (u-x>0) z.ep(u-x);
	s.clear();
	s.ep(1);
	for (int i=1;i<=n;){
		int j=n+1;
		auto it=z.upper_bound(i);
		if (it!=z.end() && *it<=2*i) j=*it;
		it=z.upper_bound(2*i);
		if (it!=z.end() && *it<=2*i+x) j=2*i;
		if (j!=n+1)s.ep(j);
		i=j;
	}
	vector<int> v;
	for (auto u:s) v.pb(n-u+1);
	sort(v.begin(),v.end());
	return {x,v};
}
# 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 Incorrect 3 ms 468 KB Not correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Correct
2 Correct 366 ms 436 KB Correct
3 Correct 118 ms 596 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 366 ms 436 KB Correct
3 Correct 118 ms 596 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 366 ms 436 KB Correct
3 Correct 118 ms 596 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 366 ms 436 KB Correct
3 Correct 118 ms 596 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 366 ms 436 KB Correct
3 Correct 118 ms 596 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 Incorrect 4 ms 424 KB Not correct
3 Halted 0 ms 0 KB -