Submission #1035041

# Submission time Handle Problem Language Result Execution time Memory
1035041 2024-07-26T03:26:28 Z Uniq0rn Mobile (BOI12_mobile) C++14
0 / 100
409 ms 32604 KB
#include <bits/stdc++.h>
using namespace std;
 
#define ld long double 
#define ll long long int
#define pi pair<int,int>
#define sz(x) (int)x.size()
#define all(x) begin(x),end(x)

int main()
{
    cin.tie(0)->sync_with_stdio(0);
    int n;
    double L;
    cin >> n >> L;
    vector<pair<double,double>> a(n);
    for(auto &[x,y]:a) cin >> x >> y;
    sort(all(a));
    auto len = [&](double a,double b){
        return sqrt(a*a - b*b);
    };
    double l = 0,r = 1e9;
    while(r - l > 0.0001){
        double mid = (l + r) / 2.0;
        double mn = a[0].first - len(mid,a[0].second),mx = a[0].first + len(mid,a[0].second);
        bool ch = (mid >= a[0].second);
        for(int i=1;i<n && ch;i++){
            if(mid < a[0].second){
                ch = false;
                break;
            }
            double le = a[i].first - len(mid,a[i].second),ri = a[i].first + len(mid,a[i].second);
            if(le <= mx){
                mx = ri;
            }
            else{
                ch = false;
                break;
            }
        }
        if(ch && mn <= 0 && mx >= L){
            r = mid;
        }
        else{
            l = mid;
        }
    }
    cout << setprecision(6) << fixed << r;
    return 0;
}

Compilation message

mobile.cpp: In function 'int main()':
mobile.cpp:17:15: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   17 |     for(auto &[x,y]:a) cin >> x >> y;
      |               ^
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 592 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 2392 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 31 ms 2396 KB Output is correct
2 Incorrect 35 ms 2764 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 40 ms 3412 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 39 ms 3432 KB Output is correct
2 Incorrect 41 ms 3408 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 178 ms 12368 KB Output is correct
2 Correct 198 ms 15832 KB Output is correct
3 Correct 187 ms 15436 KB Output is correct
4 Incorrect 200 ms 17612 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 200 ms 16464 KB Output is correct
2 Incorrect 174 ms 14672 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 212 ms 14820 KB Output is correct
2 Incorrect 224 ms 19052 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 246 ms 19576 KB Output is correct
2 Incorrect 204 ms 17744 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 251 ms 17424 KB Output is correct
2 Incorrect 279 ms 22028 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 270 ms 22868 KB Output is correct
2 Incorrect 252 ms 20488 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 280 ms 19884 KB Output is correct
2 Incorrect 301 ms 25172 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 325 ms 25936 KB Output is correct
2 Incorrect 274 ms 23380 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 346 ms 24660 KB Output is correct
2 Incorrect 391 ms 31572 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 409 ms 32604 KB Output is correct
2 Incorrect 332 ms 29268 KB Output isn't correct
3 Halted 0 ms 0 KB -