Submission #698219

# Submission time Handle Problem Language Result Execution time Memory
698219 2023-02-12T21:28:09 Z randmac Mobile (BOI12_mobile) C++14
100 / 100
494 ms 35168 KB
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <queue>
#include <math.h>
#include <iomanip>

using namespace std;

// https://oj.uz/problem/view/BOI12_mobile

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

    // freopen("mobile.in", "r", stdin);
    // freopen("mobile.out", "w", stdout);

    int N, L;
    cin >> N >> L;

    vector<pair<long long, long long>> a(N);
    
    for (int i = 0; i < N; i++) {
        cin >> a[i].first >> a[i].second;
    }

    // double ans = -1;
    // for (int i = 0; i < b.size() - 1; i++) {
    //     int x_sum = b[i].first + b[i + 1].first;
    //     int x_diff = b[i + 1].first - b[i].first;

    //     double y_squared = (b[i + 1].second + b[i].second) * (b[i + 1].second - b[i].second);
    //     double x_0 = ( y_squared / x_diff + x_sum) / 2;
    //     double distance = (b[i].first - x_0) * (b[i].first - x_0) + b[i].second * b[i].second;
    //     ans = max(ans, distance);
    // }

    double low = 1, high = 1.5e9;
	while (high - low > 1e-3) {
		double mid = low + (high - low) / 2, curr = 0;
		for (int i = 0; i < N; i++) {
			double delta = sqrt(mid * mid - a[i].second * a[i].second);
			double left = a[i].first - delta, right = a[i].first + delta;
			if (left <= curr) curr = max(curr, right);
		}

		if (curr >= L) high = mid;
		else low = mid + 1e-04;
	}


    // cout << sqrt(ans) << setprecision(4) << endl;
    cout << fixed << setprecision(4) << low << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 2 ms 352 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 2 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 2 ms 400 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 28 ms 1512 KB Output is correct
2 Correct 20 ms 1532 KB Output is correct
3 Correct 16 ms 1740 KB Output is correct
4 Correct 27 ms 2776 KB Output is correct
5 Correct 14 ms 1488 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 24 ms 1560 KB Output is correct
2 Correct 23 ms 1364 KB Output is correct
3 Correct 26 ms 1492 KB Output is correct
4 Correct 30 ms 2760 KB Output is correct
5 Correct 38 ms 3136 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 20 ms 1708 KB Output is correct
2 Correct 22 ms 1620 KB Output is correct
3 Correct 26 ms 2504 KB Output is correct
4 Correct 39 ms 3812 KB Output is correct
5 Correct 28 ms 2644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 28 ms 1876 KB Output is correct
2 Correct 29 ms 1876 KB Output is correct
3 Correct 26 ms 2908 KB Output is correct
4 Correct 38 ms 3840 KB Output is correct
5 Correct 32 ms 3132 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 27 ms 1896 KB Output is correct
2 Correct 27 ms 1896 KB Output is correct
3 Correct 33 ms 2900 KB Output is correct
4 Correct 39 ms 3836 KB Output is correct
5 Correct 33 ms 3152 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 120 ms 8148 KB Output is correct
2 Correct 142 ms 8148 KB Output is correct
3 Correct 141 ms 15300 KB Output is correct
4 Correct 193 ms 17724 KB Output is correct
5 Correct 165 ms 14916 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 146 ms 8148 KB Output is correct
2 Correct 219 ms 14672 KB Output is correct
3 Correct 134 ms 13884 KB Output is correct
4 Correct 191 ms 17468 KB Output is correct
5 Correct 173 ms 15424 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 137 ms 9704 KB Output is correct
2 Correct 174 ms 9700 KB Output is correct
3 Correct 168 ms 18272 KB Output is correct
4 Correct 230 ms 21592 KB Output is correct
5 Correct 197 ms 17636 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 169 ms 9708 KB Output is correct
2 Correct 257 ms 17624 KB Output is correct
3 Correct 163 ms 16460 KB Output is correct
4 Correct 228 ms 21348 KB Output is correct
5 Correct 208 ms 18412 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 159 ms 11380 KB Output is correct
2 Correct 197 ms 11268 KB Output is correct
3 Correct 198 ms 21368 KB Output is correct
4 Correct 264 ms 24700 KB Output is correct
5 Correct 226 ms 20292 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 201 ms 11220 KB Output is correct
2 Correct 292 ms 20472 KB Output is correct
3 Correct 193 ms 19728 KB Output is correct
4 Correct 262 ms 24640 KB Output is correct
5 Correct 237 ms 21404 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 185 ms 13224 KB Output is correct
2 Correct 223 ms 13096 KB Output is correct
3 Correct 254 ms 24556 KB Output is correct
4 Correct 305 ms 28476 KB Output is correct
5 Correct 265 ms 23984 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 229 ms 13212 KB Output is correct
2 Correct 335 ms 23440 KB Output is correct
3 Correct 217 ms 22312 KB Output is correct
4 Correct 300 ms 28296 KB Output is correct
5 Correct 268 ms 24412 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 232 ms 16652 KB Output is correct
2 Correct 276 ms 16480 KB Output is correct
3 Correct 283 ms 30432 KB Output is correct
4 Correct 494 ms 35036 KB Output is correct
5 Correct 340 ms 29644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 290 ms 15956 KB Output is correct
2 Correct 411 ms 29148 KB Output is correct
3 Correct 273 ms 28236 KB Output is correct
4 Correct 382 ms 35168 KB Output is correct
5 Correct 341 ms 30796 KB Output is correct