Submission #798425

# Submission time Handle Problem Language Result Execution time Memory
798425 2023-07-30T17:06:43 Z trMatherz Mobile (BOI12_mobile) C++17
100 / 100
812 ms 35388 KB
# include <numeric>
# include <vector>
# include <algorithm>
# include <cmath>
# include <array>
# include <bitset>
# include <set>
# include <map>
# include <string>
# include <cstdlib>
# include <queue>
# include <iomanip>

using namespace std;
#define ll long long int
#define all(x) x.begin(), x.end()
#define f x.first
#define s x.second


     # include <iostream>

/*
# include <fstream>
 ifstream cin ("angry.in");
 ofstream cout ("angry.out");
*/

/*

1 3 8 10 11
 2 5 2 1
 
 */



int main(){
    int n, k;
    cin >> n >> k;
    vector<array<ll, 2>> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i][0] >> a[i][1];
    }
    auto cf = [&](double m){
        double cur = 0;
        for(int i = 0; i < n; i++){
            double d = sqrt(m*m - a[i][1]*a[i][1]);
            double e1 = a[i][0] - d, e2 = a[i][0] + d;
            if(e1 <= cur){cur = max(cur, e2);}
        }
        if(cur >= k){return false;}
        return true;
    };
    double l = 1, r = 1.5e9;
    while(r - l > 1e-5 ){
        double m = (r+l)/2;
        if(cf(m)){l = m;}
        else{r = m;}
    }
    cout << fixed << setprecision(4) << l;
    return 0;
}
# 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 1 ms 212 KB Output is correct
4 Correct 0 ms 304 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 304 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 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 340 KB Output is correct
2 Correct 3 ms 444 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 4 ms 444 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 340 KB Output is correct
2 Correct 3 ms 416 KB Output is correct
3 Correct 3 ms 312 KB Output is correct
4 Correct 4 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 340 KB Output is correct
2 Correct 5 ms 452 KB Output is correct
3 Correct 4 ms 312 KB Output is correct
4 Correct 5 ms 340 KB Output is correct
5 Correct 3 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 54 ms 1364 KB Output is correct
2 Correct 44 ms 2508 KB Output is correct
3 Correct 29 ms 1644 KB Output is correct
4 Correct 51 ms 2636 KB Output is correct
5 Correct 24 ms 1364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 41 ms 1492 KB Output is correct
2 Correct 42 ms 2108 KB Output is correct
3 Correct 54 ms 2568 KB Output is correct
4 Correct 54 ms 2672 KB Output is correct
5 Correct 66 ms 3120 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 40 ms 1620 KB Output is correct
2 Correct 48 ms 1572 KB Output is correct
3 Correct 45 ms 2508 KB Output is correct
4 Correct 84 ms 3792 KB Output is correct
5 Correct 49 ms 2608 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 60 ms 1748 KB Output is correct
2 Correct 57 ms 3148 KB Output is correct
3 Correct 51 ms 2876 KB Output is correct
4 Correct 79 ms 3788 KB Output is correct
5 Correct 62 ms 3116 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 63 ms 1876 KB Output is correct
2 Correct 57 ms 3272 KB Output is correct
3 Correct 50 ms 2888 KB Output is correct
4 Correct 77 ms 3772 KB Output is correct
5 Correct 78 ms 3120 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 224 ms 8020 KB Output is correct
2 Correct 301 ms 15844 KB Output is correct
3 Correct 298 ms 15308 KB Output is correct
4 Correct 382 ms 17588 KB Output is correct
5 Correct 352 ms 14952 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 308 ms 8120 KB Output is correct
2 Correct 385 ms 14636 KB Output is correct
3 Correct 265 ms 13772 KB Output is correct
4 Correct 375 ms 17460 KB Output is correct
5 Correct 334 ms 15416 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 278 ms 9684 KB Output is correct
2 Correct 369 ms 18904 KB Output is correct
3 Correct 346 ms 18376 KB Output is correct
4 Correct 485 ms 21584 KB Output is correct
5 Correct 382 ms 17680 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 364 ms 9696 KB Output is correct
2 Correct 454 ms 17600 KB Output is correct
3 Correct 323 ms 16460 KB Output is correct
4 Correct 468 ms 21428 KB Output is correct
5 Correct 400 ms 18408 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 335 ms 11220 KB Output is correct
2 Correct 439 ms 22060 KB Output is correct
3 Correct 411 ms 21420 KB Output is correct
4 Correct 561 ms 24800 KB Output is correct
5 Correct 441 ms 20296 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 430 ms 11220 KB Output is correct
2 Correct 524 ms 20572 KB Output is correct
3 Correct 379 ms 19644 KB Output is correct
4 Correct 543 ms 24584 KB Output is correct
5 Correct 517 ms 21400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 361 ms 12816 KB Output is correct
2 Correct 485 ms 25232 KB Output is correct
3 Correct 467 ms 24348 KB Output is correct
4 Correct 627 ms 28452 KB Output is correct
5 Correct 519 ms 23992 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 494 ms 12820 KB Output is correct
2 Correct 601 ms 23396 KB Output is correct
3 Correct 434 ms 22292 KB Output is correct
4 Correct 649 ms 28308 KB Output is correct
5 Correct 518 ms 24416 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 458 ms 15956 KB Output is correct
2 Correct 708 ms 31500 KB Output is correct
3 Correct 583 ms 30432 KB Output is correct
4 Correct 783 ms 35164 KB Output is correct
5 Correct 692 ms 29512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 625 ms 15956 KB Output is correct
2 Correct 712 ms 29128 KB Output is correct
3 Correct 545 ms 28240 KB Output is correct
4 Correct 812 ms 35388 KB Output is correct
5 Correct 664 ms 30668 KB Output is correct