답안 #698213

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
698213 2023-02-12T21:16:37 Z randmac Mobile (BOI12_mobile) C++14
0 / 100
244 ms 31932 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;
    }

    vector<pair<int, int>> b;
    int last_x = -1;
    for (auto it : a) {
        if (last_x != -1 && it.first == last_x) continue;
        b.push_back(it);
        last_x = it.first;
    }

    // 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 - b[i].second * b[i].second);
			double left = b[i].first - delta, right = b[i].first + delta;
			if (left <= curr) curr = max(curr, right);
		}

		if (curr >= L) high = mid;
		else low = mid;
	}


    // cout << sqrt(ans) << setprecision(4) << endl;
    cout << fixed << setprecision(4) << low << endl;
}
# 결과 실행 시간 메모리 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 Incorrect 0 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 340 KB Output is correct
2 Correct 2 ms 468 KB Output is correct
3 Correct 2 ms 404 KB Output is correct
4 Incorrect 3 ms 460 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 2068 KB Output is correct
2 Runtime error 16 ms 3980 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 15 ms 1868 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 20 ms 2172 KB Output is correct
2 Runtime error 18 ms 4016 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 19 ms 2968 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 2264 KB Output is correct
2 Runtime error 19 ms 4296 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 123 ms 8440 KB Output is correct
2 Runtime error 89 ms 16500 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 90 ms 8708 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 141 ms 13332 KB Output is correct
2 Runtime error 115 ms 19456 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 106 ms 10208 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 167 ms 14120 KB Output is correct
2 Runtime error 131 ms 22540 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 124 ms 11696 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 189 ms 14880 KB Output is correct
2 Runtime error 148 ms 25756 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 143 ms 13300 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 244 ms 16456 KB Output is correct
2 Runtime error 181 ms 31932 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 188 ms 16476 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -