Submission #698218

# Submission time Handle Problem Language Result Execution time Memory
698218 2023-02-12T21:25:18 Z randmac Mobile (BOI12_mobile) C++14
12 / 100
294 ms 8148 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<int, int>> 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 = 0, 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 220 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 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 2 ms 212 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 3 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Incorrect 3 ms 340 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 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 1 ms 340 KB Output is correct
4 Incorrect 3 ms 340 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 3 ms 456 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Incorrect 3 ms 352 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 28 ms 904 KB Output is correct
2 Incorrect 31 ms 912 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 22 ms 852 KB Output is correct
2 Correct 22 ms 852 KB Output is correct
3 Incorrect 38 ms 952 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 19 ms 980 KB Output is correct
2 Incorrect 22 ms 852 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 28 ms 1108 KB Output is correct
2 Incorrect 36 ms 980 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 28 ms 1120 KB Output is correct
2 Incorrect 31 ms 1108 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 121 ms 4232 KB Output is correct
2 Incorrect 135 ms 4240 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 192 ms 4228 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 137 ms 5012 KB Output is correct
2 Incorrect 163 ms 5016 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 167 ms 5016 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 158 ms 5792 KB Output is correct
2 Incorrect 193 ms 5800 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 203 ms 5792 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 182 ms 6576 KB Output is correct
2 Incorrect 218 ms 6576 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 228 ms 6576 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 223 ms 8148 KB Output is correct
2 Incorrect 294 ms 8148 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 283 ms 8148 KB Output isn't correct
2 Halted 0 ms 0 KB -