Submission #1113751

# Submission time Handle Problem Language Result Execution time Memory
1113751 2024-11-17T10:26:59 Z Mighilon A Light Inconvenience (CEOI23_light) C++17
0 / 100
1000 ms 336 KB
#include "light.h"
#include <cstring>
#include <vector>

using namespace std;

#ifdef DEBUG
#include "../Library/debug.h"
#else
#define dbg(x...)
#endif

typedef long long ll;
 
int n,m;
ll a[150],b[150];

void prepare(){
	a[0]=1;
	n=1;
}
void update(ll v){
	for(int i=0;i<n;++i)
		a[i]+=v;
	b[0]=1;
	m=1;
	for(int i=0;i<n;++i){
		ll x=b[m-1];
		while(x*2+1<a[i]){
			while(m>=2&&b[m-2]*2+1>=x)
				m--;
			b[m++]=x;
		}
		x=a[i];
		while(m>=2&&b[m-2]*2+1>=x)
			m--;
		b[m++]=x;
	}
	memcpy(a,b,(n=m)*sizeof*b);
}

vector<ll> query(){
	vector<ll> res(n);
	for(int i=0;i<n;++i)
		res[i]=a[n-1]-a[n-1-i]+1;
	return res;
}

std::pair<long long, std::vector<long long>> join(long long p){
	update(p);
	return {p,query()};
}

std::pair<long long, std::vector<long long>> leave(long long p){
	update(-p);
	return {p,query()};
}
# Verdict Execution time Memory Grader output
1 Execution timed out 3051 ms 336 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3041 ms 336 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3048 ms 336 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3048 ms 336 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3048 ms 336 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3048 ms 336 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3048 ms 336 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3034 ms 336 KB Time limit exceeded
2 Halted 0 ms 0 KB -