Submission #1042246

# Submission time Handle Problem Language Result Execution time Memory
1042246 2024-08-02T17:40:18 Z sssamui Mobile (BOI12_mobile) C++17
0 / 100
697 ms 17324 KB
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <stack>
#include <iomanip>
using namespace std;

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

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

	double l = 0, r = 1e9;
	int it = 45;
	while (it--)
	{
		double m = (l + r) / 2;
		stack<pair<double, double>> c;
		for (int i = 0; i < n; i++) if (xy[i].second * xy[i].second <= m * m)
		{
			double sq = sqrt(m * m - xy[i].second * xy[i].second);
			double a = fmax(0, xy[i].first - sq), b = fmin(L, xy[i].first + sq);
			while (!c.empty() && (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 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 536 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 54 ms 1644 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 46 ms 1624 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 50 ms 1628 KB Output is correct
2 Correct 51 ms 1628 KB Output is correct
3 Correct 45 ms 1628 KB Output is correct
4 Incorrect 65 ms 2128 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 68 ms 1880 KB Output is correct
2 Correct 59 ms 1880 KB Output is correct
3 Correct 53 ms 1884 KB Output is correct
4 Incorrect 70 ms 2132 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 66 ms 2132 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 301 ms 8280 KB Output is correct
2 Correct 312 ms 8284 KB Output is correct
3 Correct 321 ms 8536 KB Output is correct
4 Incorrect 321 ms 8532 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 310 ms 8284 KB Output is correct
2 Incorrect 301 ms 8804 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 346 ms 9820 KB Output is correct
2 Correct 366 ms 9820 KB Output is correct
3 Correct 369 ms 9816 KB Output is correct
4 Incorrect 392 ms 10360 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 413 ms 9820 KB Output is correct
2 Incorrect 374 ms 10624 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 409 ms 11356 KB Output is correct
2 Correct 422 ms 11356 KB Output is correct
3 Correct 431 ms 11356 KB Output is correct
4 Incorrect 468 ms 12168 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 437 ms 11352 KB Output is correct
2 Incorrect 425 ms 12372 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 457 ms 12892 KB Output is correct
2 Correct 550 ms 12892 KB Output is correct
3 Correct 491 ms 12892 KB Output is correct
4 Incorrect 548 ms 14164 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 497 ms 12888 KB Output is correct
2 Incorrect 488 ms 14008 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 583 ms 15960 KB Output is correct
2 Correct 676 ms 15964 KB Output is correct
3 Correct 607 ms 15960 KB Output is correct
4 Incorrect 639 ms 17232 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 697 ms 15960 KB Output is correct
2 Incorrect 624 ms 17324 KB Output isn't correct
3 Halted 0 ms 0 KB -