Submission #976794

# Submission time Handle Problem Language Result Execution time Memory
976794 2024-05-07T06:36:46 Z Br3ad Mobile (BOI12_mobile) C++17
70 / 100
557 ms 35836 KB
#include <iostream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>

using namespace std;
#define ll long long
#define ull unsigned long long
#define f first
#define s second
#define PF push_front
#define PB push_back
#define MP make_pair
#define max(a, b) ((a > b)? a : b)
#define min(a, b) ((a < b)? a : b)
#define max3(a, b, c) max(max(a, b), c)
#define min3(a, b, c) min(min(a, b), c)

const int N = 1e5 + 5;
const int M = 1e9 + 7; 
const int inf = 0x3f3f3f3f;
const ll int INF = 1e18;

double bin(double l, double r, function<bool(double)> f){
    while(r - l > 1e-3){
        double mid = (r + l)/2;
        if(f(mid)){
            r = mid;
        }else {
            l = mid;
        }
    }
    return l;
}

int main(){
    
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    
    // ifstream cin();
    // ofstream cout();
    
    vector<pair<double, double>> v;
    int n;
    double L;
    cin >> n >> L;
    for(int i = 0; i < n; i++){
        double x, y;
        cin >> x >> y;
        v.PB(MP(x, y));
    }

    double ans = bin(1, L, [&](double d){
        double cur = 0;
        for(int i = 0; i < n; i++){
            double dis = sqrt(d*d - v[i].s * v[i].s);
            double left = v[i].f - dis, right = v[i].f + dis;
            if(left <= cur) cur = max(cur, right);
        }

        return (cur >= L);
    });
    
    cout << fixed << setprecision(3);
    cout << ans << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 600 KB Output is correct
2 Correct 3 ms 604 KB Output is correct
3 Correct 3 ms 604 KB Output is correct
4 Correct 3 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 604 KB Output is correct
2 Correct 3 ms 604 KB Output is correct
3 Correct 3 ms 604 KB Output is correct
4 Correct 3 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 600 KB Output is correct
2 Correct 3 ms 604 KB Output is correct
3 Correct 2 ms 600 KB Output is correct
4 Correct 4 ms 724 KB Output is correct
5 Correct 3 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 43 ms 3652 KB Output is correct
2 Correct 36 ms 3532 KB Output is correct
3 Correct 22 ms 2080 KB Output is correct
4 Correct 38 ms 3736 KB Output is correct
5 Incorrect 22 ms 1776 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 33 ms 3288 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 35 ms 3220 KB Output is correct
2 Incorrect 37 ms 3532 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 47 ms 3740 KB Output is correct
2 Correct 44 ms 3800 KB Output is correct
3 Correct 40 ms 3400 KB Output is correct
4 Correct 57 ms 4100 KB Output is correct
5 Correct 45 ms 3532 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 47 ms 3532 KB Output is correct
2 Correct 45 ms 3588 KB Output is correct
3 Incorrect 44 ms 3280 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 206 ms 12760 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 232 ms 16564 KB Output is correct
2 Correct 277 ms 15528 KB Output is correct
3 Correct 203 ms 14044 KB Output is correct
4 Correct 264 ms 17732 KB Output is correct
5 Correct 242 ms 15596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 248 ms 21688 KB Output is correct
2 Correct 266 ms 26036 KB Output is correct
3 Correct 257 ms 25016 KB Output is correct
4 Correct 354 ms 28596 KB Output is correct
5 Correct 343 ms 25716 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 285 ms 27696 KB Output is correct
2 Correct 333 ms 25544 KB Output is correct
3 Correct 243 ms 25020 KB Output is correct
4 Correct 352 ms 28248 KB Output is correct
5 Correct 285 ms 24940 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 281 ms 22476 KB Output is correct
2 Correct 322 ms 25996 KB Output is correct
3 Correct 298 ms 26244 KB Output is correct
4 Correct 389 ms 28852 KB Output is correct
5 Correct 327 ms 24660 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 327 ms 26504 KB Output is correct
2 Correct 375 ms 25716 KB Output is correct
3 Correct 282 ms 24300 KB Output is correct
4 Correct 384 ms 28856 KB Output is correct
5 Correct 344 ms 26580 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 331 ms 22092 KB Output is correct
2 Correct 354 ms 25984 KB Output is correct
3 Correct 335 ms 26040 KB Output is correct
4 Correct 437 ms 30640 KB Output is correct
5 Correct 392 ms 25016 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 376 ms 28084 KB Output is correct
2 Correct 451 ms 24312 KB Output is correct
3 Correct 328 ms 25012 KB Output is correct
4 Correct 441 ms 29360 KB Output is correct
5 Correct 378 ms 25268 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 393 ms 24696 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 489 ms 32848 KB Output is correct
2 Correct 521 ms 29612 KB Output is correct
3 Correct 409 ms 29132 KB Output is correct
4 Correct 557 ms 35836 KB Output is correct
5 Correct 475 ms 31144 KB Output is correct