Submission #1073885

# Submission time Handle Problem Language Result Execution time Memory
1073885 2024-08-25T01:53:10 Z vjudge1 Mobile (BOI12_mobile) C++17
40 / 100
1000 ms 89348 KB
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);

	int n;
	ld L;
	cin >> n >> L;
	vector <pair<ld,ld>> pts(n);
	for(int i=0; i<n; i++){
		cin >> pts[i].first >> pts[i].second;
	}

	const ld EPS = 1e-6;
	ld l=0, r=1e10, mid;
	while(r-l>EPS){
		mid = (l+r)/2;

		vector <pair<ld,ld>> seg;

		for(int i=0; i<n; i++){
			ld x = pts[i].first, y = pts[i].second;
			if(mid <= y){
				continue;
			}
			ld d = sqrt(mid*mid-y*y);
			if(x-d <= L && x+d >= 0)
				seg.push_back({max((ld)0.0, x-d),min((ld)L, x+d)});
		}

		sort(seg.begin(), seg.end());
		vector <pair<ld,ld>> processed;
		for(auto [start,end] : seg){
			if(!processed.empty() && start<=processed.back().second){
				processed.back().second = max(processed.back().second, end);
			}
			else{
				processed.push_back({start, end});
			}
		}

		bool can = false;
		if(processed.size() == 1){
			auto [x,y] = processed[0];
			if(abs(x) < EPS && abs(y-L) < EPS){
				can = true;
			}
		}
		if(can) r = mid;
		else l = mid;
	}
	cout << fixed << setprecision(6) << l << '\n';
	return 0;
}
# 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 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 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 11 ms 772 KB Output is correct
2 Correct 15 ms 776 KB Output is correct
3 Correct 9 ms 604 KB Output is correct
4 Correct 6 ms 756 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 21 ms 1056 KB Output is correct
2 Correct 28 ms 1048 KB Output is correct
3 Correct 36 ms 1040 KB Output is correct
4 Correct 16 ms 1064 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 20 ms 1040 KB Output is correct
2 Correct 28 ms 1048 KB Output is correct
3 Correct 39 ms 1120 KB Output is correct
4 Correct 15 ms 1036 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 20 ms 1040 KB Output is correct
2 Correct 27 ms 1044 KB Output is correct
3 Correct 39 ms 1036 KB Output is correct
4 Correct 14 ms 1032 KB Output is correct
5 Correct 22 ms 1096 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 336 ms 9612 KB Output is correct
2 Correct 681 ms 10852 KB Output is correct
3 Correct 435 ms 5872 KB Output is correct
4 Correct 264 ms 9784 KB Output is correct
5 Correct 251 ms 5668 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 410 ms 9856 KB Output is correct
2 Correct 330 ms 10272 KB Output is correct
3 Correct 348 ms 11052 KB Output is correct
4 Correct 284 ms 9944 KB Output is correct
5 Correct 264 ms 10660 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 813 ms 10088 KB Output is correct
2 Correct 734 ms 9856 KB Output is correct
3 Correct 952 ms 10852 KB Output is correct
4 Correct 228 ms 10740 KB Output is correct
5 Correct 428 ms 11208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 726 ms 11192 KB Output is correct
2 Correct 901 ms 11972 KB Output is correct
3 Execution timed out 1035 ms 12016 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 361 ms 10808 KB Output is correct
2 Correct 939 ms 10816 KB Output is correct
3 Execution timed out 1079 ms 12632 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1035 ms 48224 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1030 ms 52700 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1050 ms 71352 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1024 ms 73648 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1044 ms 74920 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1047 ms 77496 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1018 ms 78576 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1012 ms 81680 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1043 ms 85796 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1095 ms 89348 KB Time limit exceeded
2 Halted 0 ms 0 KB -