Submission #919366

# Submission time Handle Problem Language Result Execution time Memory
919366 2024-01-31T16:41:34 Z ethanv13 Mobile (BOI12_mobile) C++17
0 / 100
1000 ms 66124 KB
#include <bits/stdc++.h>
using namespace std;
vector<pair<long long,long long>>c;long long n,l;
bool can(long double mid){
	vector<pair<long double,long double>>seg;
	for(int i=0;i<n;++i){
		if(mid<abs(c[i].second)){
			return false;
		}
		else {
			long double delta=sqrt(mid*mid-c[i].second*c[i].second);
			seg.push_back({c[i].first-delta,c[i].first+delta});
		}
	}
	long double minx=4e9;
	long double currub=-4e9;
	for(int i=0;i<n;++i){
		if(minx>seg[i].first){
			minx=seg[i].first;
		}
		if(seg[i].first<=currub||currub==-4e9){
			currub=seg[i].second;continue;
		}
		else {
			return false;
		}
	}
	return currub>=l&&minx<=0;
}
int main() {
	cin>>n>>l;
	for(int i=0;i<n;++i){
		long long x,y;cin>>x>>y;c.push_back({x,y});
	}
	long double lo=0;long double hi=2e9;
	for(int i=0;i<50;++i){
		long double mid=(lo+hi)/2;
		if(can(mid)){
			hi=mid;
		}
		else {
			lo=mid;
		}
	}
	cout<<fixed<<setprecision(9);
	cout<<lo<<endl;
};
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 696 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 1180 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 1032 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 928 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 173 ms 8732 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 133 ms 8576 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 222 ms 9212 KB Output is correct
2 Correct 206 ms 9648 KB Output is correct
3 Incorrect 124 ms 8724 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 258 ms 10400 KB Output is correct
2 Correct 234 ms 10352 KB Output is correct
3 Incorrect 164 ms 9912 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 227 ms 9476 KB Output is correct
2 Correct 222 ms 9480 KB Output is correct
3 Incorrect 148 ms 9456 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1024 ms 40844 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1027 ms 40624 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1055 ms 61336 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1044 ms 60744 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1016 ms 63448 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1041 ms 62756 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1024 ms 63096 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1041 ms 66124 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1022 ms 65816 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1035 ms 65456 KB Time limit exceeded
2 Halted 0 ms 0 KB -