Submission #906113

# Submission time Handle Problem Language Result Execution time Memory
906113 2024-01-13T14:08:28 Z Nonoze Mobile (BOI12_mobile) C++17
100 / 100
609 ms 26096 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;

long double dist(long double x1, pair<long double, long double> other) {
	long double y1=0;
	long double x2=other.first, y2=other.second;
	return ((long double)sqrt((long double)((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))));
}

void solve() {
	cin >> n >> L;
	a.clear();
	a.resize(n);
	for (auto &u: a) cin >> u.first >> u.second;
	double l=0, r=1e9;
	while (r-l>=0.00001) {
		double mid=(l+r)/2;
		double borne=0;
		for (int i=0; i<n; i++) {
			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(4) << 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 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 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 348 KB Output is correct
2 Correct 2 ms 344 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 344 KB Output is correct
2 Correct 3 ms 348 KB Output is correct
3 Correct 3 ms 348 KB Output is correct
4 Correct 3 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 348 KB Output is correct
2 Correct 3 ms 348 KB Output is correct
3 Correct 3 ms 344 KB Output is correct
4 Correct 3 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 344 KB Output is correct
2 Correct 3 ms 348 KB Output is correct
3 Correct 3 ms 348 KB Output is correct
4 Correct 4 ms 604 KB Output is correct
5 Correct 3 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 48 ms 1872 KB Output is correct
2 Correct 37 ms 1628 KB Output is correct
3 Correct 25 ms 1112 KB Output is correct
4 Correct 47 ms 1628 KB Output is correct
5 Correct 24 ms 1116 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 39 ms 1688 KB Output is correct
2 Correct 37 ms 1372 KB Output is correct
3 Correct 44 ms 1628 KB Output is correct
4 Correct 46 ms 2428 KB Output is correct
5 Correct 56 ms 2672 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 37 ms 1624 KB Output is correct
2 Correct 40 ms 1728 KB Output is correct
3 Correct 40 ms 2396 KB Output is correct
4 Correct 59 ms 3156 KB Output is correct
5 Correct 47 ms 2608 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 48 ms 1880 KB Output is correct
2 Correct 46 ms 1880 KB Output is correct
3 Correct 49 ms 2136 KB Output is correct
4 Correct 59 ms 1884 KB Output is correct
5 Correct 52 ms 2652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 56 ms 2136 KB Output is correct
2 Correct 48 ms 1884 KB Output is correct
3 Correct 45 ms 1884 KB Output is correct
4 Correct 59 ms 1884 KB Output is correct
5 Correct 52 ms 1880 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 208 ms 8536 KB Output is correct
2 Correct 243 ms 12384 KB Output is correct
3 Correct 238 ms 11988 KB Output is correct
4 Correct 294 ms 13556 KB Output is correct
5 Correct 260 ms 11856 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 246 ms 8528 KB Output is correct
2 Correct 317 ms 8280 KB Output is correct
3 Correct 253 ms 11344 KB Output is correct
4 Correct 290 ms 12992 KB Output is correct
5 Correct 281 ms 12112 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 251 ms 9820 KB Output is correct
2 Correct 285 ms 14700 KB Output is correct
3 Correct 292 ms 14384 KB Output is correct
4 Correct 352 ms 15956 KB Output is correct
5 Correct 340 ms 14416 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 286 ms 9832 KB Output is correct
2 Correct 384 ms 10068 KB Output is correct
3 Correct 317 ms 10072 KB Output is correct
4 Correct 360 ms 15992 KB Output is correct
5 Correct 322 ms 14444 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 288 ms 11408 KB Output is correct
2 Correct 342 ms 17024 KB Output is correct
3 Correct 324 ms 16776 KB Output is correct
4 Correct 440 ms 18320 KB Output is correct
5 Correct 371 ms 16268 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 341 ms 11408 KB Output is correct
2 Correct 435 ms 11412 KB Output is correct
3 Correct 363 ms 15736 KB Output is correct
4 Correct 435 ms 18256 KB Output is correct
5 Correct 418 ms 16764 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 337 ms 12976 KB Output is correct
2 Correct 389 ms 19376 KB Output is correct
3 Correct 394 ms 18884 KB Output is correct
4 Correct 527 ms 21164 KB Output is correct
5 Correct 461 ms 18868 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 396 ms 12972 KB Output is correct
2 Correct 498 ms 12964 KB Output is correct
3 Correct 402 ms 18088 KB Output is correct
4 Correct 502 ms 20904 KB Output is correct
5 Correct 465 ms 19116 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 424 ms 16104 KB Output is correct
2 Correct 491 ms 16100 KB Output is correct
3 Correct 475 ms 16108 KB Output is correct
4 Correct 609 ms 25752 KB Output is correct
5 Correct 553 ms 22880 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 481 ms 16124 KB Output is correct
2 Correct 601 ms 16104 KB Output is correct
3 Correct 475 ms 22624 KB Output is correct
4 Correct 586 ms 26096 KB Output is correct
5 Correct 568 ms 23788 KB Output is correct