Submission #1031425

# Submission time Handle Problem Language Result Execution time Memory
1031425 2024-07-22T20:25:28 Z shezitt Mobile (BOI12_mobile) C++14
100 / 100
490 ms 15964 KB
#include <bits/stdc++.h>

using namespace std;

using ll = long long;

#define int ll
#define vi vector<int>
#define ii pair<int,int>
#define x first
#define y second
#define fore(a, b, c) for(int a=b; a<c; ++a)
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define endl '\n'
#define dbg(x) cerr << #x << ": " << x << endl
#define raya cerr << "================" << endl;

double eps = 1e-4;

signed main(){

    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int n, len;
    cin >> n >> len;

    vector<ii> p(n);
    fore(i, 0, n){
        cin >> p[i].x >> p[i].y;
    }

    double low = 0, high = 1e9+5;

    while((high - low) > eps){
        double mid = low + (high - low) / 2;
        
        double mx = 0;

        fore(i, 0, n){
            double delta = (2*p[i].x)*(2*p[i].x)-4*(p[i].x*p[i].x+p[i].y*p[i].y-mid*mid);
            double a = (2*p[i].x - sqrt(delta)) / 2;
            double b = (2*p[i].x + sqrt(delta)) / 2;
            
            if(a <= mx){
                mx = max(mx, b);
            }
        }

        if(mx >= len){
            high = mid;
        } else {
            low = mid;
        }

    }

    cout << fixed << setprecision(6) << high;

}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 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 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 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 2 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 ms 532 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 3 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 2 ms 536 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
5 Correct 2 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 39 ms 1628 KB Output is correct
2 Correct 24 ms 1628 KB Output is correct
3 Correct 16 ms 1112 KB Output is correct
4 Correct 34 ms 1628 KB Output is correct
5 Correct 17 ms 1116 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 51 ms 1628 KB Output is correct
2 Correct 31 ms 1368 KB Output is correct
3 Correct 36 ms 1628 KB Output is correct
4 Correct 44 ms 1628 KB Output is correct
5 Correct 40 ms 1624 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 21 ms 1624 KB Output is correct
2 Correct 21 ms 1628 KB Output is correct
3 Correct 24 ms 1628 KB Output is correct
4 Correct 82 ms 1884 KB Output is correct
5 Correct 35 ms 1628 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 32 ms 1884 KB Output is correct
2 Correct 27 ms 2132 KB Output is correct
3 Correct 28 ms 1884 KB Output is correct
4 Correct 52 ms 1880 KB Output is correct
5 Correct 72 ms 1884 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 27 ms 1880 KB Output is correct
2 Correct 26 ms 1880 KB Output is correct
3 Correct 28 ms 1884 KB Output is correct
4 Correct 53 ms 1880 KB Output is correct
5 Correct 44 ms 1884 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 124 ms 8284 KB Output is correct
2 Correct 133 ms 8284 KB Output is correct
3 Correct 132 ms 8284 KB Output is correct
4 Correct 235 ms 8284 KB Output is correct
5 Correct 209 ms 8284 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 123 ms 8280 KB Output is correct
2 Correct 260 ms 8284 KB Output is correct
3 Correct 147 ms 8284 KB Output is correct
4 Correct 227 ms 8284 KB Output is correct
5 Correct 236 ms 8280 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 154 ms 9820 KB Output is correct
2 Correct 165 ms 9820 KB Output is correct
3 Correct 150 ms 9820 KB Output is correct
4 Correct 294 ms 9820 KB Output is correct
5 Correct 228 ms 9816 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 159 ms 9820 KB Output is correct
2 Correct 317 ms 9816 KB Output is correct
3 Correct 177 ms 9820 KB Output is correct
4 Correct 289 ms 9816 KB Output is correct
5 Correct 231 ms 9816 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 170 ms 11356 KB Output is correct
2 Correct 178 ms 11352 KB Output is correct
3 Correct 179 ms 11356 KB Output is correct
4 Correct 327 ms 11356 KB Output is correct
5 Correct 283 ms 11356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 179 ms 11352 KB Output is correct
2 Correct 339 ms 11356 KB Output is correct
3 Correct 193 ms 11352 KB Output is correct
4 Correct 315 ms 11352 KB Output is correct
5 Correct 304 ms 11356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 181 ms 12888 KB Output is correct
2 Correct 201 ms 12888 KB Output is correct
3 Correct 216 ms 12888 KB Output is correct
4 Correct 362 ms 12892 KB Output is correct
5 Correct 325 ms 12888 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 193 ms 12888 KB Output is correct
2 Correct 387 ms 12892 KB Output is correct
3 Correct 212 ms 12888 KB Output is correct
4 Correct 365 ms 12888 KB Output is correct
5 Correct 320 ms 12888 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 233 ms 15964 KB Output is correct
2 Correct 267 ms 15964 KB Output is correct
3 Correct 253 ms 15964 KB Output is correct
4 Correct 490 ms 15960 KB Output is correct
5 Correct 407 ms 15964 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 276 ms 15960 KB Output is correct
2 Correct 478 ms 15964 KB Output is correct
3 Correct 298 ms 15960 KB Output is correct
4 Correct 442 ms 15960 KB Output is correct
5 Correct 422 ms 15964 KB Output is correct