Submission #906171

# Submission time Handle Problem Language Result Execution time Memory
906171 2024-01-13T15:08:38 Z Nonoze Mobile (BOI12_mobile) C++17
100 / 100
296 ms 18612 KB
#include <bits/stdc++.h>
#define sz(x) (int)(x.size())

using namespace std;

int n, L;
vector<pair<double, double>> a;

void solve() {
	cin >> n >> L;
	a.clear();
	for (int i=0; i<n; i++) {
		int x, y; cin >> x >> y;
		if (!a.empty() && x==a.back().first) {
			if (abs(y)<abs(a.back().second)) a.back().second=y;
			continue;
		}
		a.push_back({x, y});
	}
	n=sz(a);
	double l=0, r=1e9;
	while (r-l>0.0009) {
		double mid=(l+r)/2;
		double borne=0;
		for (int i=0; i<n; i++) {
			if (abs(a[i].second)>mid) continue;
			double x=a[i].first, y=a[i].second;
			double dist=sqrt(pow(mid, 2)-pow(y, 2));
			if (x-dist<=borne && x+dist>borne) borne=x+dist;
		}
		if (borne>=L) r=mid;
		else l=mid;
	}
	cout << fixed << setprecision(3) << l << endl;
	return;
}


signed main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	solve();
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 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 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 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 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 2 ms 604 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 2 ms 604 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 604 KB Output is correct
2 Correct 2 ms 604 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 ms 604 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 22 ms 2616 KB Output is correct
2 Correct 23 ms 1500 KB Output is correct
3 Correct 17 ms 1500 KB Output is correct
4 Correct 18 ms 2520 KB Output is correct
5 Correct 5 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 604 KB Output is correct
2 Correct 13 ms 1504 KB Output is correct
3 Correct 17 ms 2520 KB Output is correct
4 Correct 18 ms 2516 KB Output is correct
5 Correct 24 ms 2520 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 29 ms 2516 KB Output is correct
2 Correct 18 ms 1496 KB Output is correct
3 Correct 18 ms 2520 KB Output is correct
4 Correct 23 ms 2520 KB Output is correct
5 Correct 13 ms 992 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 20 ms 1500 KB Output is correct
2 Correct 19 ms 1500 KB Output is correct
3 Correct 13 ms 736 KB Output is correct
4 Correct 24 ms 2520 KB Output is correct
5 Correct 23 ms 2520 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 27 ms 2628 KB Output is correct
2 Correct 19 ms 1496 KB Output is correct
3 Correct 13 ms 736 KB Output is correct
4 Correct 23 ms 2520 KB Output is correct
5 Correct 22 ms 2520 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 125 ms 9508 KB Output is correct
2 Correct 66 ms 592 KB Output is correct
3 Correct 67 ms 604 KB Output is correct
4 Correct 108 ms 9396 KB Output is correct
5 Correct 98 ms 8900 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 74 ms 712 KB Output is correct
2 Correct 166 ms 10700 KB Output is correct
3 Correct 72 ms 2504 KB Output is correct
4 Correct 126 ms 8640 KB Output is correct
5 Correct 104 ms 10692 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 147 ms 17152 KB Output is correct
2 Correct 78 ms 596 KB Output is correct
3 Correct 75 ms 492 KB Output is correct
4 Correct 135 ms 16824 KB Output is correct
5 Correct 115 ms 9772 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 83 ms 596 KB Output is correct
2 Correct 192 ms 18612 KB Output is correct
3 Correct 73 ms 2504 KB Output is correct
4 Correct 136 ms 18288 KB Output is correct
5 Correct 129 ms 17592 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 180 ms 17636 KB Output is correct
2 Correct 94 ms 596 KB Output is correct
3 Correct 86 ms 600 KB Output is correct
4 Correct 164 ms 18480 KB Output is correct
5 Correct 117 ms 10016 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 92 ms 852 KB Output is correct
2 Correct 221 ms 18348 KB Output is correct
3 Correct 96 ms 2764 KB Output is correct
4 Correct 157 ms 17488 KB Output is correct
5 Correct 143 ms 18424 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 188 ms 17064 KB Output is correct
2 Correct 104 ms 596 KB Output is correct
3 Correct 99 ms 640 KB Output is correct
4 Correct 182 ms 17072 KB Output is correct
5 Correct 150 ms 8920 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 109 ms 644 KB Output is correct
2 Correct 258 ms 17076 KB Output is correct
3 Correct 104 ms 2508 KB Output is correct
4 Correct 197 ms 18104 KB Output is correct
5 Correct 164 ms 18108 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 230 ms 17244 KB Output is correct
2 Correct 140 ms 484 KB Output is correct
3 Correct 137 ms 592 KB Output is correct
4 Correct 239 ms 17556 KB Output is correct
5 Correct 177 ms 8896 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 134 ms 596 KB Output is correct
2 Correct 296 ms 18224 KB Output is correct
3 Correct 130 ms 5572 KB Output is correct
4 Correct 265 ms 17604 KB Output is correct
5 Correct 205 ms 18104 KB Output is correct