Submission #906140

# Submission time Handle Problem Language Result Execution time Memory
906140 2024-01-13T14:41:09 Z Nonoze Mobile (BOI12_mobile) C++17
100 / 100
399 ms 26812 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;

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

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++) {
			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 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 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 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 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 604 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 3 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 600 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 3 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 28 ms 2520 KB Output is correct
2 Correct 17 ms 1500 KB Output is correct
3 Correct 16 ms 2016 KB Output is correct
4 Correct 28 ms 3288 KB Output is correct
5 Correct 6 ms 860 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 12 ms 604 KB Output is correct
2 Correct 21 ms 2020 KB Output is correct
3 Correct 26 ms 3276 KB Output is correct
4 Correct 42 ms 3544 KB Output is correct
5 Correct 34 ms 3740 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 22 ms 2772 KB Output is correct
2 Correct 20 ms 1516 KB Output is correct
3 Correct 31 ms 3100 KB Output is correct
4 Correct 46 ms 3256 KB Output is correct
5 Correct 15 ms 1748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 28 ms 1500 KB Output is correct
2 Correct 23 ms 2524 KB Output is correct
3 Correct 14 ms 1504 KB Output is correct
4 Correct 63 ms 3348 KB Output is correct
5 Correct 31 ms 3568 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 28 ms 2436 KB Output is correct
2 Correct 19 ms 1500 KB Output is correct
3 Correct 21 ms 1456 KB Output is correct
4 Correct 40 ms 3408 KB Output is correct
5 Correct 35 ms 3028 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 116 ms 9156 KB Output is correct
2 Correct 95 ms 892 KB Output is correct
3 Correct 68 ms 4768 KB Output is correct
4 Correct 247 ms 13812 KB Output is correct
5 Correct 143 ms 13620 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 77 ms 676 KB Output is correct
2 Correct 245 ms 13364 KB Output is correct
3 Correct 77 ms 5404 KB Output is correct
4 Correct 286 ms 13448 KB Output is correct
5 Correct 169 ms 12224 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 142 ms 18356 KB Output is correct
2 Correct 77 ms 596 KB Output is correct
3 Correct 84 ms 5464 KB Output is correct
4 Correct 238 ms 23000 KB Output is correct
5 Correct 145 ms 14484 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 89 ms 592 KB Output is correct
2 Correct 252 ms 20904 KB Output is correct
3 Correct 80 ms 6136 KB Output is correct
4 Correct 232 ms 23220 KB Output is correct
5 Correct 191 ms 23656 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 164 ms 17592 KB Output is correct
2 Correct 90 ms 536 KB Output is correct
3 Correct 93 ms 5968 KB Output is correct
4 Correct 264 ms 23596 KB Output is correct
5 Correct 146 ms 14788 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 91 ms 500 KB Output is correct
2 Correct 275 ms 21084 KB Output is correct
3 Correct 107 ms 7112 KB Output is correct
4 Correct 258 ms 25172 KB Output is correct
5 Correct 220 ms 22776 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 196 ms 18104 KB Output is correct
2 Correct 100 ms 592 KB Output is correct
3 Correct 105 ms 7104 KB Output is correct
4 Correct 296 ms 24308 KB Output is correct
5 Correct 218 ms 14192 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 104 ms 596 KB Output is correct
2 Correct 322 ms 22712 KB Output is correct
3 Correct 114 ms 7744 KB Output is correct
4 Correct 301 ms 23960 KB Output is correct
5 Correct 260 ms 24080 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 228 ms 18872 KB Output is correct
2 Correct 125 ms 552 KB Output is correct
3 Correct 132 ms 7828 KB Output is correct
4 Correct 376 ms 26812 KB Output is correct
5 Correct 234 ms 14944 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 133 ms 596 KB Output is correct
2 Correct 399 ms 22968 KB Output is correct
3 Correct 147 ms 11748 KB Output is correct
4 Correct 375 ms 26084 KB Output is correct
5 Correct 321 ms 23264 KB Output is correct