Submission #906159

# Submission time Handle Problem Language Result Execution time Memory
906159 2024-01-13T14:57:04 Z Nonoze Mobile (BOI12_mobile) C++17
100 / 100
336 ms 10816 KB
#include <bits/stdc++.h>
#define sz(x) (int)(x.size())

using namespace std;

int n, L;
vector<pair<int, int>> 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.0005) {
		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 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 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 344 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 2 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 2 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 26 ms 1500 KB Output is correct
2 Correct 18 ms 1144 KB Output is correct
3 Correct 13 ms 988 KB Output is correct
4 Correct 19 ms 1500 KB Output is correct
5 Correct 6 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 492 KB Output is correct
2 Correct 15 ms 992 KB Output is correct
3 Correct 17 ms 1500 KB Output is correct
4 Correct 19 ms 1500 KB Output is correct
5 Correct 27 ms 1420 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 21 ms 1496 KB Output is correct
2 Correct 18 ms 1244 KB Output is correct
3 Correct 19 ms 1500 KB Output is correct
4 Correct 28 ms 1500 KB Output is correct
5 Correct 16 ms 736 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 20 ms 992 KB Output is correct
2 Correct 20 ms 992 KB Output is correct
3 Correct 13 ms 604 KB Output is correct
4 Correct 24 ms 1532 KB Output is correct
5 Correct 21 ms 1500 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 26 ms 1500 KB Output is correct
2 Correct 20 ms 956 KB Output is correct
3 Correct 13 ms 600 KB Output is correct
4 Correct 28 ms 1756 KB Output is correct
5 Correct 22 ms 1500 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 118 ms 6360 KB Output is correct
2 Correct 66 ms 556 KB Output is correct
3 Correct 67 ms 596 KB Output is correct
4 Correct 116 ms 5560 KB Output is correct
5 Correct 98 ms 4904 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 72 ms 624 KB Output is correct
2 Correct 180 ms 6344 KB Output is correct
3 Correct 66 ms 1432 KB Output is correct
4 Correct 118 ms 5960 KB Output is correct
5 Correct 107 ms 5544 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 141 ms 9664 KB Output is correct
2 Correct 78 ms 484 KB Output is correct
3 Correct 80 ms 348 KB Output is correct
4 Correct 144 ms 10428 KB Output is correct
5 Correct 110 ms 5832 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 86 ms 600 KB Output is correct
2 Correct 222 ms 10184 KB Output is correct
3 Correct 82 ms 1568 KB Output is correct
4 Correct 139 ms 9152 KB Output is correct
5 Correct 166 ms 9660 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 166 ms 9408 KB Output is correct
2 Correct 88 ms 464 KB Output is correct
3 Correct 89 ms 344 KB Output is correct
4 Correct 170 ms 10396 KB Output is correct
5 Correct 136 ms 5680 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 106 ms 852 KB Output is correct
2 Correct 245 ms 9920 KB Output is correct
3 Correct 108 ms 1572 KB Output is correct
4 Correct 167 ms 9408 KB Output is correct
5 Correct 160 ms 9212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 221 ms 9860 KB Output is correct
2 Correct 108 ms 540 KB Output is correct
3 Correct 105 ms 528 KB Output is correct
4 Correct 192 ms 10264 KB Output is correct
5 Correct 158 ms 5320 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 112 ms 476 KB Output is correct
2 Correct 292 ms 10488 KB Output is correct
3 Correct 104 ms 1524 KB Output is correct
4 Correct 209 ms 10612 KB Output is correct
5 Correct 172 ms 9076 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 278 ms 10252 KB Output is correct
2 Correct 150 ms 500 KB Output is correct
3 Correct 138 ms 464 KB Output is correct
4 Correct 254 ms 9620 KB Output is correct
5 Correct 195 ms 5320 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 137 ms 464 KB Output is correct
2 Correct 336 ms 10816 KB Output is correct
3 Correct 132 ms 2512 KB Output is correct
4 Correct 235 ms 10328 KB Output is correct
5 Correct 225 ms 9364 KB Output is correct