Submission #919363

# Submission time Handle Problem Language Result Execution time Memory
919363 2024-01-31T16:35:55 Z ethanv13 Mobile (BOI12_mobile) C++17
0 / 100
1000 ms 94988 KB
#include <bits/stdc++.h>
using namespace std;
vector<pair<long long,long long>>c;long long n,l;
bool can(long double mid){
	set<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.insert({c[i].first-delta,c[i].first+delta});
		}
	}
	long double minx=4e9;
	long double currub=-4e9;
	for(set<pair<long double,long double>>::iterator k=seg.begin();k!=seg.end();++k){
		pair<long double,long double> p=*k;
		if(minx>p.first){
			minx=p.first;
		}
		if(p.first<=currub||currub==-4e9){
			currub=p.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 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 600 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 42 ms 892 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 36 ms 856 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 40 ms 860 KB Output is correct
2 Correct 32 ms 1104 KB Output is correct
3 Incorrect 32 ms 1112 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 615 ms 7472 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 879 ms 7752 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 804 ms 8640 KB Output is correct
2 Execution timed out 1032 ms 8124 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 995 ms 9820 KB Output is correct
2 Execution timed out 1038 ms 9660 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 858 ms 9848 KB Output is correct
2 Execution timed out 1039 ms 9660 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1038 ms 47572 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1040 ms 47232 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1039 ms 57420 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1049 ms 57680 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1050 ms 66508 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1028 ms 67656 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1036 ms 77536 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1040 ms 76824 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1025 ms 94988 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1052 ms 94176 KB Time limit exceeded
2 Halted 0 ms 0 KB -