Submission #906161

# Submission time Handle Problem Language Result Execution time Memory
906161 2024-01-13T14:59:18 Z Nonoze Mobile (BOI12_mobile) C++17
100 / 100
295 ms 18972 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((double)(mid*mid-y*y));
			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 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 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 344 KB Output is correct
3 Correct 1 ms 348 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 344 KB Output is correct
4 Correct 2 ms 612 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 604 KB Output is correct
2 Correct 2 ms 660 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 ms 604 KB Output is correct
5 Correct 2 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 25 ms 2520 KB Output is correct
2 Correct 18 ms 1500 KB Output is correct
3 Correct 14 ms 1496 KB Output is correct
4 Correct 18 ms 2580 KB Output is correct
5 Correct 6 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 604 KB Output is correct
2 Correct 13 ms 1500 KB Output is correct
3 Correct 17 ms 2772 KB Output is correct
4 Correct 19 ms 2520 KB Output is correct
5 Correct 20 ms 2516 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 21 ms 2520 KB Output is correct
2 Correct 18 ms 1500 KB Output is correct
3 Correct 23 ms 2520 KB Output is correct
4 Correct 25 ms 2516 KB Output is correct
5 Correct 13 ms 992 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 19 ms 1496 KB Output is correct
2 Correct 19 ms 1500 KB Output is correct
3 Correct 14 ms 736 KB Output is correct
4 Correct 23 ms 2520 KB Output is correct
5 Correct 21 ms 2516 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 27 ms 2520 KB Output is correct
2 Correct 19 ms 1500 KB Output is correct
3 Correct 13 ms 836 KB Output is correct
4 Correct 25 ms 2520 KB Output is correct
5 Correct 21 ms 2520 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 133 ms 10176 KB Output is correct
2 Correct 65 ms 672 KB Output is correct
3 Correct 72 ms 836 KB Output is correct
4 Correct 109 ms 9152 KB Output is correct
5 Correct 98 ms 10696 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 86 ms 708 KB Output is correct
2 Correct 163 ms 10180 KB Output is correct
3 Correct 66 ms 2640 KB Output is correct
4 Correct 130 ms 8692 KB Output is correct
5 Correct 102 ms 8904 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 137 ms 17188 KB Output is correct
2 Correct 99 ms 592 KB Output is correct
3 Correct 75 ms 556 KB Output is correct
4 Correct 137 ms 17408 KB Output is correct
5 Correct 108 ms 8676 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 80 ms 592 KB Output is correct
2 Correct 189 ms 18356 KB Output is correct
3 Correct 74 ms 2508 KB Output is correct
4 Correct 133 ms 18972 KB Output is correct
5 Correct 126 ms 17592 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 179 ms 17080 KB Output is correct
2 Correct 90 ms 556 KB Output is correct
3 Correct 86 ms 596 KB Output is correct
4 Correct 193 ms 17788 KB Output is correct
5 Correct 119 ms 10776 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 104 ms 636 KB Output is correct
2 Correct 209 ms 16908 KB Output is correct
3 Correct 93 ms 2528 KB Output is correct
4 Correct 218 ms 17836 KB Output is correct
5 Correct 142 ms 17048 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 221 ms 18576 KB Output is correct
2 Correct 105 ms 632 KB Output is correct
3 Correct 99 ms 596 KB Output is correct
4 Correct 201 ms 17336 KB Output is correct
5 Correct 154 ms 8900 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 107 ms 492 KB Output is correct
2 Correct 245 ms 18880 KB Output is correct
3 Correct 104 ms 2508 KB Output is correct
4 Correct 174 ms 17652 KB Output is correct
5 Correct 162 ms 18672 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 240 ms 18068 KB Output is correct
2 Correct 128 ms 592 KB Output is correct
3 Correct 121 ms 532 KB Output is correct
4 Correct 255 ms 17940 KB Output is correct
5 Correct 176 ms 9148 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 133 ms 472 KB Output is correct
2 Correct 295 ms 17868 KB Output is correct
3 Correct 132 ms 6376 KB Output is correct
4 Correct 274 ms 16824 KB Output is correct
5 Correct 200 ms 17336 KB Output is correct