Submission #965007

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

#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<abs(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)));
	}
	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;
	for(int i = 0;i<60;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 1 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 0 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 344 KB Output is correct
3 Correct 1 ms 504 KB Output is correct
4 Correct 1 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 604 KB Output is correct
2 Correct 4 ms 612 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 4 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 760 KB Output is correct
2 Correct 9 ms 760 KB Output is correct
3 Correct 14 ms 748 KB Output is correct
4 Correct 5 ms 748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 764 KB Output is correct
2 Correct 9 ms 748 KB Output is correct
3 Correct 14 ms 748 KB Output is correct
4 Correct 5 ms 748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 748 KB Output is correct
2 Correct 9 ms 748 KB Output is correct
3 Correct 16 ms 904 KB Output is correct
4 Correct 5 ms 732 KB Output is correct
5 Correct 6 ms 740 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 123 ms 5980 KB Output is correct
2 Correct 282 ms 6000 KB Output is correct
3 Correct 179 ms 4600 KB Output is correct
4 Correct 89 ms 5940 KB Output is correct
5 Correct 74 ms 4508 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 112 ms 5984 KB Output is correct
2 Correct 103 ms 5884 KB Output is correct
3 Correct 100 ms 6048 KB Output is correct
4 Correct 92 ms 5996 KB Output is correct
5 Correct 86 ms 6132 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 202 ms 6248 KB Output is correct
2 Correct 319 ms 6076 KB Output is correct
3 Correct 391 ms 6136 KB Output is correct
4 Correct 60 ms 6692 KB Output is correct
5 Correct 121 ms 6160 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 328 ms 6352 KB Output is correct
2 Correct 420 ms 6340 KB Output is correct
3 Correct 503 ms 6580 KB Output is correct
4 Correct 71 ms 6244 KB Output is correct
5 Correct 121 ms 6332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 224 ms 6360 KB Output is correct
2 Correct 378 ms 6860 KB Output is correct
3 Correct 482 ms 6400 KB Output is correct
4 Correct 73 ms 6164 KB Output is correct
5 Correct 124 ms 6328 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1053 ms 27440 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1018 ms 29464 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1100 ms 40660 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1038 ms 44044 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1035 ms 45736 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1004 ms 48128 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1102 ms 48804 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1082 ms 52088 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 54032 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1081 ms 57036 KB Time limit exceeded
2 Halted 0 ms 0 KB -