Submission #965027

# Submission time Handle Problem Language Result Execution time Memory
965027 2024-04-18T03:23:38 Z pcc Mobile (BOI12_mobile) C++17
50 / 100
1000 ms 58044 KB
#include <bits/stdc++.h>
using namespace std;

#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,popcnt,sse4")

#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fs first
#define sc second
#define tlll tuple<ll,ll,ll>
#define ld double
#define pld pair<ld,ld>

const int mxn = 1e6+10;
ll N,L;
pair<ll,ll> arr[mxn];

inline bool check(ld r){
	vector<pld> v;
	for(int i = 0;i<N;i++){
		if(r<arr[i].sc)continue;
		v.push_back(pld(arr[i].fs-sqrt(r*r-arr[i].sc*arr[i].sc),arr[i].fs+sqrt(r*r-arr[i].sc*arr[i].sc)));
		if(v.back().fs<0&&v.back().sc>L)return true;
	}
	sort(v.begin(),v.end());
	ld pre = 0;
	for(auto &i:v){
		if(pre>L)return true;
		if(pre<i.fs)return false;
		pre = max(pre,i.sc);
	}
	return pre>L;
}

int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	ld l = 0,r = 2e9;
	cin>>N>>L;
	for(int i = 0;i<N;i++)cin>>arr[i].fs>>arr[i].sc,arr[i].sc = abs(arr[i].sc);
	for(int i = 0;r-l>0.001;i++){
		ld mid = (l+r)/2;
		if(check(mid))r = mid;
		else l = mid;
	}
	cout<<fixed<<setprecision(10)<<l<<'\n';
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 2 ms 600 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 3 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 3 ms 748 KB Output is correct
3 Correct 4 ms 604 KB Output is correct
4 Correct 1 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 604 KB Output is correct
2 Correct 3 ms 748 KB Output is correct
3 Correct 4 ms 604 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 760 KB Output is correct
2 Correct 3 ms 764 KB Output is correct
3 Correct 5 ms 600 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 58 ms 5940 KB Output is correct
2 Correct 108 ms 5960 KB Output is correct
3 Correct 75 ms 4320 KB Output is correct
4 Correct 19 ms 3372 KB Output is correct
5 Correct 8 ms 3296 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 20 ms 3360 KB Output is correct
2 Correct 21 ms 3516 KB Output is correct
3 Correct 19 ms 3420 KB Output is correct
4 Correct 19 ms 3480 KB Output is correct
5 Correct 21 ms 3660 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 99 ms 6228 KB Output is correct
2 Correct 114 ms 6032 KB Output is correct
3 Correct 79 ms 4680 KB Output is correct
4 Correct 25 ms 4040 KB Output is correct
5 Correct 17 ms 3576 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 159 ms 6428 KB Output is correct
2 Correct 154 ms 6348 KB Output is correct
3 Correct 155 ms 5904 KB Output is correct
4 Correct 26 ms 4032 KB Output is correct
5 Correct 21 ms 4236 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 161 ms 6408 KB Output is correct
2 Correct 157 ms 6332 KB Output is correct
3 Correct 155 ms 5880 KB Output is correct
4 Correct 26 ms 4152 KB Output is correct
5 Correct 21 ms 4152 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 564 ms 25032 KB Output is correct
2 Execution timed out 1047 ms 24948 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1044 ms 24960 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 800 ms 37428 KB Output is correct
2 Execution timed out 1037 ms 38408 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1051 ms 38284 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 895 ms 41628 KB Output is correct
2 Execution timed out 1066 ms 40480 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1038 ms 40412 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 941 ms 44920 KB Output is correct
2 Execution timed out 1046 ms 58044 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1044 ms 45524 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1054 ms 48920 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1018 ms 49032 KB Time limit exceeded
2 Halted 0 ms 0 KB -