답안 #1039509

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1039509 2024-07-31T02:02:37 Z pcc Measures (CEOI22_measures) C++17
0 / 100
1500 ms 448 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;
ll 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 = 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);
		cout<<calc(v)/2.0<<' ';
	}
	cout<<'\n';
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 344 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 344 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1567 ms 448 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1567 ms 448 KB Time limit exceeded
2 Halted 0 ms 0 KB -