Submission #1073881

# Submission time Handle Problem Language Result Execution time Memory
1073881 2024-08-25T01:43:47 Z vjudge1 Mobile (BOI12_mobile) C++17
0 / 100
1000 ms 78624 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;
	ll L;
	cin >> n >> L;
	
	vector <pair<ll,ll>> pts;
	for(int i=0; i<n; i++){
		ll x, y;
		cin >> x >> y;
		if(!pts.empty() && x == pts.back().first){
			pts.back().second = min(pts.back().second, abs(y));
		}
		else{
			pts.push_back({x,abs(y)});
		}
	}
	n = pts.size();

	const ld EPS = 1e-8;
	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);
			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 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 740 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 784 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 33 ms 824 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 686 ms 9704 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 36 ms 1628 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 794 ms 10412 KB Output is correct
2 Correct 440 ms 6148 KB Output is correct
3 Correct 869 ms 10600 KB Output is correct
4 Execution timed out 1035 ms 11468 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 299 ms 6132 KB Output is correct
2 Correct 368 ms 5968 KB Output is correct
3 Correct 173 ms 2692 KB Output is correct
4 Execution timed out 1079 ms 11216 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1037 ms 10780 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1014 ms 44836 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 112 ms 9724 KB Output is correct
2 Execution timed out 1038 ms 47628 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1035 ms 66028 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 106 ms 10880 KB Output is correct
2 Execution timed out 1047 ms 68232 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1061 ms 68056 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 120 ms 12372 KB Output is correct
2 Execution timed out 1078 ms 72060 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1054 ms 71304 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 128 ms 14100 KB Output is correct
2 Execution timed out 1077 ms 75168 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1038 ms 74372 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 142 ms 17236 KB Output is correct
2 Execution timed out 1025 ms 78624 KB Time limit exceeded
3 Halted 0 ms 0 KB -