Submission #906149

# Submission time Handle Problem Language Result Execution time Memory
906149 2024-01-13T14:51:03 Z Nonoze Mobile (BOI12_mobile) C++17
100 / 100
312 ms 19384 KB
#include <bits/stdc++.h>

#define int long long
#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.0001) {
		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 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 344 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 600 KB Output is correct
2 Correct 2 ms 348 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 344 KB Output is correct
2 Correct 2 ms 600 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 2 ms 604 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 600 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 23 ms 2580 KB Output is correct
2 Correct 18 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 15 ms 1500 KB Output is correct
3 Correct 18 ms 2520 KB Output is correct
4 Correct 20 ms 2520 KB Output is correct
5 Correct 20 ms 2520 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 28 ms 2516 KB Output is correct
2 Correct 19 ms 1496 KB Output is correct
3 Correct 23 ms 2520 KB Output is correct
4 Correct 23 ms 2588 KB Output is correct
5 Correct 13 ms 988 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 19 ms 1496 KB Output is correct
2 Correct 18 ms 1500 KB Output is correct
3 Correct 12 ms 856 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 27 ms 2520 KB Output is correct
2 Correct 18 ms 1500 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 128 ms 10440 KB Output is correct
2 Correct 64 ms 592 KB Output is correct
3 Correct 63 ms 604 KB Output is correct
4 Correct 110 ms 10464 KB Output is correct
5 Correct 97 ms 10436 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 66 ms 604 KB Output is correct
2 Correct 182 ms 10180 KB Output is correct
3 Correct 68 ms 2524 KB Output is correct
4 Correct 110 ms 8900 KB Output is correct
5 Correct 103 ms 9056 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 145 ms 18108 KB Output is correct
2 Correct 81 ms 636 KB Output is correct
3 Correct 76 ms 660 KB Output is correct
4 Correct 145 ms 17544 KB Output is correct
5 Correct 110 ms 10108 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 93 ms 592 KB Output is correct
2 Correct 206 ms 17056 KB Output is correct
3 Correct 72 ms 2508 KB Output is correct
4 Correct 136 ms 18104 KB Output is correct
5 Correct 128 ms 18764 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 172 ms 18644 KB Output is correct
2 Correct 89 ms 568 KB Output is correct
3 Correct 86 ms 596 KB Output is correct
4 Correct 160 ms 17076 KB Output is correct
5 Correct 117 ms 9576 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 94 ms 548 KB Output is correct
2 Correct 223 ms 18712 KB Output is correct
3 Correct 93 ms 2612 KB Output is correct
4 Correct 157 ms 18356 KB Output is correct
5 Correct 156 ms 17332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 196 ms 17336 KB Output is correct
2 Correct 104 ms 552 KB Output is correct
3 Correct 97 ms 492 KB Output is correct
4 Correct 197 ms 18332 KB Output is correct
5 Correct 149 ms 9152 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 104 ms 548 KB Output is correct
2 Correct 257 ms 17080 KB Output is correct
3 Correct 105 ms 2504 KB Output is correct
4 Correct 193 ms 17848 KB Output is correct
5 Correct 165 ms 17844 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 244 ms 17936 KB Output is correct
2 Correct 128 ms 488 KB Output is correct
3 Correct 124 ms 596 KB Output is correct
4 Correct 275 ms 17448 KB Output is correct
5 Correct 172 ms 10804 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 137 ms 556 KB Output is correct
2 Correct 312 ms 19384 KB Output is correct
3 Correct 134 ms 4812 KB Output is correct
4 Correct 258 ms 17872 KB Output is correct
5 Correct 204 ms 16944 KB Output is correct