Submission #998939

# Submission time Handle Problem Language Result Execution time Memory
998939 2024-06-15T01:34:39 Z hippo123 Mobile (BOI12_mobile) C++17
100 / 100
711 ms 35412 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define pr pair<ll, ll>

#define pb push_back
#define f first
#define s second
vector<pr> d(1000001);
int n; double L;

bool comp(pr a, pr b){
	if(a.f==b.f) return a.s*a.s<b.s*b.s;
	return a.f<b.f;
}


int main(){
	 cin>>n>>L;
	

	for (int i=0; i<n; i++) {
		cin>>d[i].f>>d[i].s; 
	}
	
	//sort(d.begin(), d.begin()+n, comp);
	
	//for (int i=0; i<n; i++) cout<<d[i].f<<" " <<d[i].s<<" :"<<endl;
	
	double lft=0; double rht=1.5e9;
	while (rht-lft>1e-4){
		double mid=(rht+lft)/2;
		double curr=0;
		for (int i=0; i<n; i++){
			double dx=sqrt(mid*mid-d[i].s*d[i].s);
			double x1, x2;
			x1=d[i].f-dx; x2=d[i].f+dx;
			if(x1<=curr) curr=max(curr, x2); 
		}
		if(curr>=L) rht=mid;
		else lft=mid;
	
	}
	cout << fixed <<setprecision(4);
	cout<<lft<<endl;
	
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 15960 KB Output is correct
2 Correct 4 ms 15964 KB Output is correct
3 Correct 2 ms 15964 KB Output is correct
4 Correct 3 ms 15964 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 15960 KB Output is correct
2 Correct 2 ms 15964 KB Output is correct
3 Correct 2 ms 15964 KB Output is correct
4 Correct 2 ms 15964 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 15964 KB Output is correct
2 Correct 3 ms 15964 KB Output is correct
3 Correct 3 ms 15964 KB Output is correct
4 Correct 7 ms 16100 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 15964 KB Output is correct
2 Correct 5 ms 15964 KB Output is correct
3 Correct 6 ms 15960 KB Output is correct
4 Correct 6 ms 16092 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 15960 KB Output is correct
2 Correct 6 ms 15964 KB Output is correct
3 Correct 5 ms 15964 KB Output is correct
4 Correct 5 ms 16104 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 15964 KB Output is correct
2 Correct 5 ms 16104 KB Output is correct
3 Correct 5 ms 15964 KB Output is correct
4 Correct 6 ms 15964 KB Output is correct
5 Correct 5 ms 15896 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 46 ms 16072 KB Output is correct
2 Correct 40 ms 16080 KB Output is correct
3 Correct 28 ms 16472 KB Output is correct
4 Correct 48 ms 17240 KB Output is correct
5 Correct 22 ms 16476 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 38 ms 15964 KB Output is correct
2 Correct 41 ms 15960 KB Output is correct
3 Correct 46 ms 15964 KB Output is correct
4 Correct 51 ms 17232 KB Output is correct
5 Correct 59 ms 17492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 36 ms 15964 KB Output is correct
2 Correct 45 ms 15964 KB Output is correct
3 Correct 41 ms 16976 KB Output is correct
4 Correct 76 ms 18000 KB Output is correct
5 Correct 48 ms 17004 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 55 ms 15964 KB Output is correct
2 Correct 54 ms 15964 KB Output is correct
3 Correct 48 ms 16976 KB Output is correct
4 Correct 77 ms 18004 KB Output is correct
5 Correct 56 ms 17332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 55 ms 15960 KB Output is correct
2 Correct 52 ms 15964 KB Output is correct
3 Correct 48 ms 16888 KB Output is correct
4 Correct 74 ms 18008 KB Output is correct
5 Correct 56 ms 17344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 198 ms 16076 KB Output is correct
2 Correct 269 ms 15964 KB Output is correct
3 Correct 260 ms 23120 KB Output is correct
4 Correct 362 ms 25408 KB Output is correct
5 Correct 284 ms 22864 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 274 ms 15964 KB Output is correct
2 Correct 343 ms 22480 KB Output is correct
3 Correct 233 ms 21584 KB Output is correct
4 Correct 351 ms 25168 KB Output is correct
5 Correct 298 ms 23360 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 232 ms 15960 KB Output is correct
2 Correct 317 ms 15964 KB Output is correct
3 Correct 312 ms 24656 KB Output is correct
4 Correct 433 ms 27728 KB Output is correct
5 Correct 336 ms 24004 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 333 ms 15964 KB Output is correct
2 Correct 402 ms 23888 KB Output is correct
3 Correct 274 ms 22716 KB Output is correct
4 Correct 429 ms 27728 KB Output is correct
5 Correct 356 ms 24660 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 268 ms 16072 KB Output is correct
2 Correct 387 ms 16076 KB Output is correct
3 Correct 369 ms 26192 KB Output is correct
4 Correct 504 ms 29516 KB Output is correct
5 Correct 389 ms 24896 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 385 ms 15964 KB Output is correct
2 Correct 461 ms 25152 KB Output is correct
3 Correct 331 ms 24448 KB Output is correct
4 Correct 509 ms 29264 KB Output is correct
5 Correct 419 ms 26204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 306 ms 15964 KB Output is correct
2 Correct 436 ms 15960 KB Output is correct
3 Correct 425 ms 27472 KB Output is correct
4 Correct 592 ms 31572 KB Output is correct
5 Correct 466 ms 27224 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 439 ms 16076 KB Output is correct
2 Correct 528 ms 26444 KB Output is correct
3 Correct 381 ms 25428 KB Output is correct
4 Correct 570 ms 31316 KB Output is correct
5 Correct 467 ms 27604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 399 ms 15964 KB Output is correct
2 Correct 535 ms 15964 KB Output is correct
3 Correct 528 ms 30548 KB Output is correct
4 Correct 711 ms 35156 KB Output is correct
5 Correct 570 ms 29524 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 546 ms 15964 KB Output is correct
2 Correct 632 ms 29268 KB Output is correct
3 Correct 499 ms 28244 KB Output is correct
4 Correct 699 ms 35412 KB Output is correct
5 Correct 601 ms 30808 KB Output is correct