Submission #965435

# Submission time Handle Problem Language Result Execution time Memory
965435 2024-04-18T14:07:48 Z pcc Mobile (BOI12_mobile) C++17
100 / 100
768 ms 65376 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)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 344 KB Output is correct
2 Correct 0 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 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 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 348 KB Output is correct
2 Correct 2 ms 604 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 604 KB Output is correct
2 Correct 2 ms 832 KB Output is correct
3 Correct 2 ms 604 KB Output is correct
4 Correct 1 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 604 KB Output is correct
2 Correct 3 ms 828 KB Output is correct
3 Correct 2 ms 600 KB Output is correct
4 Correct 2 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 812 KB Output is correct
2 Correct 2 ms 828 KB Output is correct
3 Correct 2 ms 604 KB Output is correct
4 Correct 2 ms 604 KB Output is correct
5 Correct 2 ms 472 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 35 ms 6716 KB Output is correct
2 Correct 44 ms 7104 KB Output is correct
3 Correct 25 ms 5036 KB Output is correct
4 Correct 17 ms 4652 KB Output is correct
5 Correct 7 ms 3680 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 4124 KB Output is correct
2 Correct 13 ms 4288 KB Output is correct
3 Correct 15 ms 4648 KB Output is correct
4 Correct 16 ms 4760 KB Output is correct
5 Correct 18 ms 5064 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 62 ms 6872 KB Output is correct
2 Correct 38 ms 7252 KB Output is correct
3 Correct 25 ms 5680 KB Output is correct
4 Correct 23 ms 6092 KB Output is correct
5 Correct 15 ms 4532 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 72 ms 7932 KB Output is correct
2 Correct 66 ms 7816 KB Output is correct
3 Correct 37 ms 6928 KB Output is correct
4 Correct 23 ms 6084 KB Output is correct
5 Correct 19 ms 5516 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 91 ms 7892 KB Output is correct
2 Correct 55 ms 8048 KB Output is correct
3 Correct 39 ms 6984 KB Output is correct
4 Correct 24 ms 6164 KB Output is correct
5 Correct 18 ms 5324 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 382 ms 29284 KB Output is correct
2 Correct 245 ms 32604 KB Output is correct
3 Correct 201 ms 32148 KB Output is correct
4 Correct 111 ms 25504 KB Output is correct
5 Correct 96 ms 22772 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 349 ms 33304 KB Output is correct
2 Correct 256 ms 31996 KB Output is correct
3 Correct 168 ms 28616 KB Output is correct
4 Correct 124 ms 24728 KB Output is correct
5 Correct 103 ms 23988 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 534 ms 43152 KB Output is correct
2 Correct 322 ms 46084 KB Output is correct
3 Correct 211 ms 47008 KB Output is correct
4 Correct 138 ms 30840 KB Output is correct
5 Correct 115 ms 26644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 505 ms 48608 KB Output is correct
2 Correct 322 ms 45720 KB Output is correct
3 Correct 237 ms 33288 KB Output is correct
4 Correct 134 ms 29708 KB Output is correct
5 Correct 115 ms 27656 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 606 ms 47108 KB Output is correct
2 Correct 386 ms 51204 KB Output is correct
3 Correct 343 ms 51064 KB Output is correct
4 Correct 160 ms 34520 KB Output is correct
5 Correct 121 ms 30824 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 450 ms 55312 KB Output is correct
2 Correct 358 ms 50664 KB Output is correct
3 Correct 254 ms 37536 KB Output is correct
4 Correct 184 ms 40500 KB Output is correct
5 Correct 140 ms 30596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 665 ms 52632 KB Output is correct
2 Correct 415 ms 57320 KB Output is correct
3 Correct 282 ms 55828 KB Output is correct
4 Correct 179 ms 43568 KB Output is correct
5 Correct 164 ms 40264 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 545 ms 58404 KB Output is correct
2 Correct 396 ms 55132 KB Output is correct
3 Correct 240 ms 51536 KB Output is correct
4 Correct 199 ms 45008 KB Output is correct
5 Correct 145 ms 34928 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 768 ms 57204 KB Output is correct
2 Correct 378 ms 63816 KB Output is correct
3 Correct 515 ms 63560 KB Output is correct
4 Correct 224 ms 50336 KB Output is correct
5 Correct 194 ms 44712 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 695 ms 65376 KB Output is correct
2 Correct 474 ms 61544 KB Output is correct
3 Correct 360 ms 57140 KB Output is correct
4 Correct 230 ms 50752 KB Output is correct
5 Correct 195 ms 46808 KB Output is correct