Submission #998937

# Submission time Handle Problem Language Result Execution time Memory
998937 2024-06-15T01:31:32 Z hippo123 Mobile (BOI12_mobile) C++17
12 / 100
541 ms 23632 KB
#include <bits/stdc++.h>
using namespace std;
 
#define pr pair<int, int>
#define ll long long
#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=L;
	while (rht-lft>1e-5){
		double mid=lft+(rht-lft)/2;
		//cout<<" lft/rht/mid= "<<lft<<" "<<rht<<" "<<mid<<endl;

		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 2 ms 8028 KB Output is correct
2 Correct 2 ms 8028 KB Output is correct
3 Correct 2 ms 8280 KB Output is correct
4 Correct 2 ms 8280 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 8024 KB Output is correct
2 Correct 2 ms 8028 KB Output is correct
3 Correct 2 ms 8276 KB Output is correct
4 Correct 2 ms 8284 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 8028 KB Output is correct
2 Correct 3 ms 8284 KB Output is correct
3 Correct 2 ms 8284 KB Output is correct
4 Correct 4 ms 8284 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 8028 KB Output is correct
2 Correct 4 ms 8340 KB Output is correct
3 Correct 4 ms 8284 KB Output is correct
4 Incorrect 4 ms 8284 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 8028 KB Output is correct
2 Correct 5 ms 8284 KB Output is correct
3 Correct 5 ms 8284 KB Output is correct
4 Incorrect 5 ms 8284 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 8028 KB Output is correct
2 Correct 5 ms 8284 KB Output is correct
3 Correct 4 ms 8152 KB Output is correct
4 Incorrect 5 ms 8284 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 50 ms 8028 KB Output is correct
2 Incorrect 38 ms 9152 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 50 ms 8024 KB Output is correct
2 Correct 34 ms 9052 KB Output is correct
3 Incorrect 63 ms 9052 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 30 ms 8028 KB Output is correct
2 Incorrect 40 ms 9300 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 53 ms 8024 KB Output is correct
2 Incorrect 49 ms 9512 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 54 ms 8028 KB Output is correct
2 Incorrect 50 ms 9564 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 182 ms 8028 KB Output is correct
2 Incorrect 252 ms 15784 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 262 ms 8028 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 225 ms 8252 KB Output is correct
2 Incorrect 309 ms 17492 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 323 ms 8248 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 261 ms 8028 KB Output is correct
2 Incorrect 375 ms 19020 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 371 ms 8248 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 306 ms 8028 KB Output is correct
2 Incorrect 402 ms 20564 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 426 ms 8028 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 373 ms 8028 KB Output is correct
2 Incorrect 514 ms 23632 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 541 ms 8028 KB Output isn't correct
2 Halted 0 ms 0 KB -