Submission #976799

# Submission time Handle Problem Language Result Execution time Memory
976799 2024-05-07T06:39:44 Z Br3ad Mobile (BOI12_mobile) C++17
100 / 100
557 ms 18776 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(0, 1.5e9, [&](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(4);
    cout << ans << endl;
}
# 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 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 604 KB Output is correct
2 Correct 3 ms 468 KB Output is correct
3 Correct 2 ms 604 KB Output is correct
4 Correct 3 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 600 KB Output is correct
2 Correct 3 ms 852 KB Output is correct
3 Correct 2 ms 604 KB Output is correct
4 Correct 3 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 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
5 Correct 3 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 40 ms 2516 KB Output is correct
2 Correct 35 ms 2864 KB Output is correct
3 Correct 24 ms 1500 KB Output is correct
4 Correct 40 ms 2488 KB Output is correct
5 Correct 22 ms 1500 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 37 ms 2520 KB Output is correct
2 Correct 35 ms 2580 KB Output is correct
3 Correct 44 ms 3544 KB Output is correct
4 Correct 45 ms 3536 KB Output is correct
5 Correct 46 ms 3888 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 36 ms 2564 KB Output is correct
2 Correct 37 ms 2612 KB Output is correct
3 Correct 38 ms 3532 KB Output is correct
4 Correct 59 ms 4044 KB Output is correct
5 Correct 46 ms 3304 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 47 ms 2520 KB Output is correct
2 Correct 46 ms 2520 KB Output is correct
3 Correct 44 ms 2520 KB Output is correct
4 Correct 58 ms 2516 KB Output is correct
5 Correct 49 ms 2772 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 50 ms 2668 KB Output is correct
2 Correct 45 ms 2568 KB Output is correct
3 Correct 44 ms 2652 KB Output is correct
4 Correct 57 ms 2516 KB Output is correct
5 Correct 50 ms 2516 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 205 ms 10372 KB Output is correct
2 Correct 231 ms 15956 KB Output is correct
3 Correct 239 ms 15756 KB Output is correct
4 Correct 281 ms 17848 KB Output is correct
5 Correct 251 ms 15052 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 233 ms 10156 KB Output is correct
2 Correct 284 ms 8904 KB Output is correct
3 Correct 223 ms 9700 KB Output is correct
4 Correct 275 ms 10172 KB Output is correct
5 Correct 248 ms 10176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 245 ms 17076 KB Output is correct
2 Correct 284 ms 18616 KB Output is correct
3 Correct 270 ms 17448 KB Output is correct
4 Correct 334 ms 17572 KB Output is correct
5 Correct 300 ms 18676 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 285 ms 17084 KB Output is correct
2 Correct 339 ms 17072 KB Output is correct
3 Correct 261 ms 18576 KB Output is correct
4 Correct 333 ms 18360 KB Output is correct
5 Correct 300 ms 18356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 286 ms 16980 KB Output is correct
2 Correct 315 ms 17064 KB Output is correct
3 Correct 321 ms 17536 KB Output is correct
4 Correct 413 ms 18612 KB Output is correct
5 Correct 424 ms 18100 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 334 ms 17080 KB Output is correct
2 Correct 385 ms 16912 KB Output is correct
3 Correct 305 ms 17332 KB Output is correct
4 Correct 380 ms 18612 KB Output is correct
5 Correct 360 ms 18020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 342 ms 18296 KB Output is correct
2 Correct 365 ms 17668 KB Output is correct
3 Correct 359 ms 17936 KB Output is correct
4 Correct 446 ms 17572 KB Output is correct
5 Correct 401 ms 16932 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 376 ms 17420 KB Output is correct
2 Correct 440 ms 18684 KB Output is correct
3 Correct 372 ms 17176 KB Output is correct
4 Correct 441 ms 18580 KB Output is correct
5 Correct 404 ms 17592 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 406 ms 18356 KB Output is correct
2 Correct 473 ms 18100 KB Output is correct
3 Correct 480 ms 17880 KB Output is correct
4 Correct 557 ms 18776 KB Output is correct
5 Correct 500 ms 17332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 482 ms 17168 KB Output is correct
2 Correct 542 ms 18620 KB Output is correct
3 Correct 476 ms 18216 KB Output is correct
4 Correct 557 ms 18464 KB Output is correct
5 Correct 526 ms 17600 KB Output is correct