Submission #1042245

# Submission time Handle Problem Language Result Execution time Memory
1042245 2024-08-02T17:35:02 Z sssamui Mobile (BOI12_mobile) C++17
0 / 100
1000 ms 31580 KB
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <stack>
#include <iomanip>
using namespace std;
using ld = long double;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	int n;
	ld L;
	cin >> n >> L;
	vector<pair<ld, ld>> xy(n);
	for (int i = 0; i < n; i++) cin >> xy[i].first >> xy[i].second;

	ld l = 0, r = 4e9;
	int it = 45;
	while (it--)
	{
		ld m = (l + r) / 2;
		stack<pair<ld, ld>> c;
		for (int i = 0; i < n; i++) if (xy[i].second <= m)
		{
			ld sq = sqrt(m * m - xy[i].second * xy[i].second);
			ld a = fmax(0, xy[i].first - sq), b = fmin(L, xy[i].first + sq);
			while (!c.empty() && ((c.top().second >= a) || (c.top().second <= -a)))
			{
				a = fmin(a, c.top().first), b = fmax(b, c.top().second);
				c.pop();
			}

			c.push({ a, b });
		}

		if ((c.size() != 1) || ((c.top().first > 0) || (c.top().second < L))) l = m;
		else r = m;
	}

	cout << fixed << setprecision(3) << l;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 600 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 175 ms 2800 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 175 ms 2908 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 201 ms 3164 KB Output is correct
2 Correct 191 ms 2908 KB Output is correct
3 Correct 166 ms 2904 KB Output is correct
4 Incorrect 236 ms 3420 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 229 ms 3416 KB Output is correct
2 Correct 241 ms 3416 KB Output is correct
3 Correct 197 ms 3420 KB Output is correct
4 Incorrect 235 ms 3420 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 232 ms 3668 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1047 ms 15960 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1062 ms 15964 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1062 ms 19036 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1029 ms 19032 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1044 ms 22616 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1073 ms 22364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1060 ms 25436 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1063 ms 25436 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1056 ms 31580 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1079 ms 31576 KB Time limit exceeded
2 Halted 0 ms 0 KB -