Submission #713021

# Submission time Handle Problem Language Result Execution time Memory
713021 2023-03-20T22:01:05 Z Ahmed57 Mobile (BOI12_mobile) C++14
100 / 100
998 ms 30724 KB
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")

#include <bits/stdc++.h>

using namespace std;
pair<double,double> cordinates[1000001];
int n;double l;
bool ch(double mid){
    double cur = 0,x,begi,en;
    for(int i =0;i<n;i++){
        if(cordinates[i].second>mid)continue;
        x = sqrt((mid*mid)-(cordinates[i].second*cordinates[i].second));
        begi = cordinates[i].first-x;
        en = cordinates[i].first+x;
        if(begi<=cur)cur = max(cur,en);
        if(cur>=l)return 1;
    }return 0;
}
int main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    cin>>n>>l;
    for(int i = 0;i<n;i++){
        cin>>cordinates[i].first>>cordinates[i].second;
    }
    double l = 0.0 ,r = 1000000000.0;
    for(int i = 0;i<60;i++){
        double mid=(l+r)/2.0;
        if(ch(mid))r = mid;
        else l = mid;
    }
    cout<<setprecision(9)<<fixed<<r<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 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 1 ms 212 KB Output is correct
4 Correct 1 ms 212 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 4 ms 340 KB Output is correct
2 Correct 3 ms 340 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 5 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 340 KB Output is correct
2 Correct 4 ms 360 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 5 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 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 Correct 6 ms 340 KB Output is correct
5 Correct 3 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 63 ms 1480 KB Output is correct
2 Correct 57 ms 1384 KB Output is correct
3 Correct 26 ms 1108 KB Output is correct
4 Correct 65 ms 1492 KB Output is correct
5 Correct 25 ms 1060 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 46 ms 1484 KB Output is correct
2 Correct 64 ms 1352 KB Output is correct
3 Correct 94 ms 1496 KB Output is correct
4 Correct 79 ms 1560 KB Output is correct
5 Correct 78 ms 1656 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 45 ms 1680 KB Output is correct
2 Correct 48 ms 1572 KB Output is correct
3 Correct 43 ms 1612 KB Output is correct
4 Correct 99 ms 1804 KB Output is correct
5 Correct 58 ms 1660 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 58 ms 1812 KB Output is correct
2 Correct 57 ms 1792 KB Output is correct
3 Correct 55 ms 1764 KB Output is correct
4 Correct 100 ms 1812 KB Output is correct
5 Correct 76 ms 1868 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 62 ms 1868 KB Output is correct
2 Correct 69 ms 1844 KB Output is correct
3 Correct 53 ms 1764 KB Output is correct
4 Correct 105 ms 1872 KB Output is correct
5 Correct 78 ms 1876 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 263 ms 8112 KB Output is correct
2 Correct 318 ms 8176 KB Output is correct
3 Correct 262 ms 8140 KB Output is correct
4 Correct 509 ms 8156 KB Output is correct
5 Correct 398 ms 8140 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 301 ms 8164 KB Output is correct
2 Correct 337 ms 8136 KB Output is correct
3 Correct 247 ms 8080 KB Output is correct
4 Correct 486 ms 8140 KB Output is correct
5 Correct 456 ms 8140 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 341 ms 9700 KB Output is correct
2 Correct 357 ms 9808 KB Output is correct
3 Correct 337 ms 9600 KB Output is correct
4 Correct 609 ms 9940 KB Output is correct
5 Correct 472 ms 9716 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 359 ms 9732 KB Output is correct
2 Correct 427 ms 9620 KB Output is correct
3 Correct 297 ms 9732 KB Output is correct
4 Correct 619 ms 9836 KB Output is correct
5 Correct 550 ms 9648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 402 ms 11312 KB Output is correct
2 Correct 402 ms 11212 KB Output is correct
3 Correct 383 ms 11284 KB Output is correct
4 Correct 682 ms 11272 KB Output is correct
5 Correct 558 ms 11260 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 448 ms 11168 KB Output is correct
2 Correct 458 ms 11276 KB Output is correct
3 Correct 344 ms 11260 KB Output is correct
4 Correct 687 ms 11272 KB Output is correct
5 Correct 608 ms 11280 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 448 ms 12764 KB Output is correct
2 Correct 453 ms 12844 KB Output is correct
3 Correct 437 ms 12876 KB Output is correct
4 Correct 794 ms 12944 KB Output is correct
5 Correct 640 ms 12980 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 482 ms 12872 KB Output is correct
2 Correct 553 ms 12776 KB Output is correct
3 Correct 363 ms 12816 KB Output is correct
4 Correct 771 ms 12808 KB Output is correct
5 Correct 638 ms 12852 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 519 ms 15836 KB Output is correct
2 Correct 572 ms 15908 KB Output is correct
3 Correct 553 ms 15912 KB Output is correct
4 Correct 998 ms 15992 KB Output is correct
5 Correct 832 ms 29548 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 595 ms 16048 KB Output is correct
2 Correct 648 ms 15920 KB Output is correct
3 Correct 509 ms 15860 KB Output is correct
4 Correct 965 ms 15968 KB Output is correct
5 Correct 859 ms 30724 KB Output is correct