Submission #1039503

# Submission time Handle Problem Language Result Execution time Memory
1039503 2024-07-31T01:47:52 Z pcc Measures (CEOI22_measures) C++17
0 / 100
1500 ms 724 KB
#include <bits/stdc++.h>
using namespace std;

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

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

ll calc(vector<ll> &v){
	sort(v.begin(),v.end());
	ll l = 0,r = 1e15;
	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++){
		int k;
		cin>>k;
		v.push_back(k<<1);
	}
	while(M--){
		int k;
		cin>>k;
		v.push_back(k<<1);
		cout<<calc(v)/2.0<<' ';
	}
	cout<<'\n';
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Incorrect 2 ms 344 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Incorrect 2 ms 344 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1553 ms 724 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1553 ms 724 KB Time limit exceeded
2 Halted 0 ms 0 KB -