Submission #1039510

# Submission time Handle Problem Language Result Execution time Memory
1039510 2024-07-31T02:07:33 Z pcc Measures (CEOI22_measures) C++17
24 / 100
1500 ms 4056 KB
#include <bits/stdc++.h>
using namespace std;

#define pii pair<int,int>
#define fs first
#define sc second
#define ll long long
#define ld long double
const int mxn = 3e5+10;
ll N,M,D;

bool check(vector<ll> &v,ll len){
	ld pre = -1e18;
	for(auto &i:v){
		if(i+len<pre+D)return false;
		pre = max(pre+D,(ld)i-len);
	}
	return true;
}

ll calc(vector<ll> &v){
	sort(v.begin(),v.end());
	ll l = 0,r = 3e15;
	assert(check(v,r));
	while(l != r){
		ll mid = (l+r)>>1;
		if(check(v,mid))r = mid;
		else l = mid+1;
	}
	return l;
}

vector<ll> v;

int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>N>>M>>D;
	D<<=1;
	for(int i = 0;i<N;i++){
		ll k;
		cin>>k;
		v.push_back(k<<1);
	}
	while(M--){
		ll k;
		cin>>k;
		v.push_back(k<<1);
		ll re = calc(v);
		cout<<(re>>1)<<(re&1?".5 ":" ");
	}
	cout<<'\n';
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 8 ms 348 KB Output is correct
2 Correct 9 ms 348 KB Output is correct
3 Correct 9 ms 348 KB Output is correct
4 Correct 9 ms 348 KB Output is correct
5 Correct 9 ms 348 KB Output is correct
6 Correct 8 ms 508 KB Output is correct
7 Correct 9 ms 504 KB Output is correct
8 Correct 9 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 348 KB Output is correct
2 Correct 9 ms 348 KB Output is correct
3 Correct 9 ms 348 KB Output is correct
4 Correct 9 ms 348 KB Output is correct
5 Correct 9 ms 348 KB Output is correct
6 Correct 8 ms 508 KB Output is correct
7 Correct 9 ms 504 KB Output is correct
8 Correct 9 ms 504 KB Output is correct
9 Correct 849 ms 4056 KB Output is correct
10 Correct 866 ms 4052 KB Output is correct
11 Correct 846 ms 4056 KB Output is correct
12 Correct 914 ms 4052 KB Output is correct
13 Correct 822 ms 3544 KB Output is correct
14 Correct 749 ms 4052 KB Output is correct
15 Correct 887 ms 3540 KB Output is correct
16 Correct 784 ms 4056 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1508 ms 620 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1508 ms 620 KB Time limit exceeded
2 Halted 0 ms 0 KB -