Submission #906139

# Submission time Handle Problem Language Result Execution time Memory
906139 2024-01-13T14:39:45 Z Nonoze Mobile (BOI12_mobile) C++17
25 / 100
240 ms 21044 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});
	}
	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 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 344 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 352 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 ms 520 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 2 ms 348 KB Output is correct
4 Correct 2 ms 856 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 600 KB Output is correct
2 Correct 2 ms 604 KB Output is correct
3 Correct 2 ms 352 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 604 KB Output is correct
3 Correct 2 ms 344 KB Output is correct
4 Correct 3 ms 604 KB Output is correct
5 Correct 2 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 29 ms 3028 KB Output is correct
2 Runtime error 13 ms 3280 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 10 ms 1624 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 25 ms 3060 KB Output is correct
2 Runtime error 13 ms 3288 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 16 ms 3288 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 27 ms 3532 KB Output is correct
2 Runtime error 20 ms 3272 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 122 ms 12256 KB Output is correct
2 Runtime error 72 ms 5276 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 96 ms 5556 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 148 ms 20916 KB Output is correct
2 Runtime error 83 ms 6080 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 91 ms 6300 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 166 ms 19892 KB Output is correct
2 Runtime error 102 ms 6896 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 98 ms 6952 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 187 ms 20916 KB Output is correct
2 Runtime error 120 ms 7768 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 120 ms 7760 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 240 ms 21044 KB Output is correct
2 Runtime error 151 ms 8676 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 140 ms 9552 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -