Submission #1056918

# Submission time Handle Problem Language Result Execution time Memory
1056918 2024-08-13T12:24:50 Z TimAni Mobile (BOI12_mobile) C++17
95 / 100
1000 ms 41048 KB
// time-limit: 3000
 
#include <bits/stdc++.h>
 
using namespace std;
using ll = long long;
 
const double eps = 1E-4;
 
struct point {
    int x{}, y{};
};
 
void solve() {
    int n, L;
    cin >> n >> L;
    vector<point> p(n);
    for(int i = 0; i < n; i++) {
        cin >> p[i].x >> p[i].y;
    }
    auto intersection = [&](const point& A, double R) -> array<double, 2> {
        if(abs(A.y) > R) {
            return {1e18, -1e18};
        }
        double D = 1.0 * R * R - 1.0 * A.y * A.y; // divided by 4
        double x1 = A.x - sqrt(D);
        double x2 = A.x + sqrt(D);
        if(x2 < x1) swap(x1, x2);
        return {x1, x2};
    };
 
    auto good = [&](double R) {
        vector<array<double, 2>> segs;
        for(int i = 0; i < n; i++) {
            if(abs(p[i].y) > R) continue;
            segs.push_back(intersection(p[i], R));
        }
        if(segs.empty()) return false;
        double t = 0;
        for(auto [l, r] : segs) {
            if(l <= t && r >= t) t = r;
        }
        return t >= L;
    };
 
    double l = 0, r = 4e9;
    while(r - l > eps) {
        double R = (r + l) / 2;
        if(good(R)) {
            r = R;
        }
        else {
            l = R;
        }
    }
    cout << fixed << setprecision(-log10(eps)) << r << endl;
}
 
int main() {
    cin.tie(0)->sync_with_stdio(0);
    double T = 1;
    //cin >> T;
    while(T--) solve();
    return 0;
}

# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 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 0 ms 348 KB Output is correct
3 Correct 0 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 2 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 700 KB Output is correct
2 Correct 5 ms 712 KB Output is correct
3 Correct 4 ms 780 KB Output is correct
4 Correct 3 ms 680 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 716 KB Output is correct
2 Correct 5 ms 700 KB Output is correct
3 Correct 4 ms 700 KB Output is correct
4 Correct 2 ms 700 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 716 KB Output is correct
2 Correct 5 ms 716 KB Output is correct
3 Correct 4 ms 716 KB Output is correct
4 Correct 2 ms 716 KB Output is correct
5 Correct 4 ms 696 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 66 ms 4344 KB Output is correct
2 Correct 94 ms 4388 KB Output is correct
3 Correct 50 ms 2788 KB Output is correct
4 Correct 34 ms 4308 KB Output is correct
5 Correct 32 ms 2724 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 59 ms 4692 KB Output is correct
2 Correct 44 ms 4240 KB Output is correct
3 Correct 45 ms 4452 KB Output is correct
4 Correct 35 ms 4348 KB Output is correct
5 Correct 31 ms 4556 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 101 ms 4692 KB Output is correct
2 Correct 103 ms 4592 KB Output is correct
3 Correct 64 ms 4576 KB Output is correct
4 Correct 27 ms 4796 KB Output is correct
5 Correct 51 ms 4712 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 107 ms 4968 KB Output is correct
2 Correct 120 ms 4956 KB Output is correct
3 Correct 97 ms 4900 KB Output is correct
4 Correct 28 ms 4888 KB Output is correct
5 Correct 53 ms 4936 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 110 ms 4952 KB Output is correct
2 Correct 109 ms 4956 KB Output is correct
3 Correct 97 ms 4964 KB Output is correct
4 Correct 29 ms 4888 KB Output is correct
5 Correct 48 ms 4916 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 446 ms 20908 KB Output is correct
2 Correct 496 ms 20428 KB Output is correct
3 Correct 443 ms 20424 KB Output is correct
4 Correct 126 ms 20636 KB Output is correct
5 Correct 198 ms 20924 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 446 ms 20456 KB Output is correct
2 Correct 348 ms 20728 KB Output is correct
3 Correct 427 ms 20416 KB Output is correct
4 Correct 150 ms 20796 KB Output is correct
5 Correct 172 ms 20820 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 688 ms 32168 KB Output is correct
2 Correct 702 ms 32536 KB Output is correct
3 Correct 698 ms 32588 KB Output is correct
4 Correct 151 ms 32380 KB Output is correct
5 Correct 298 ms 31212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 694 ms 32288 KB Output is correct
2 Correct 500 ms 34188 KB Output is correct
3 Correct 465 ms 32100 KB Output is correct
4 Correct 214 ms 31600 KB Output is correct
5 Correct 293 ms 31216 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 809 ms 33924 KB Output is correct
2 Correct 821 ms 33356 KB Output is correct
3 Correct 786 ms 35064 KB Output is correct
4 Correct 183 ms 34344 KB Output is correct
5 Correct 329 ms 34060 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 751 ms 36784 KB Output is correct
2 Correct 506 ms 36716 KB Output is correct
3 Correct 494 ms 34356 KB Output is correct
4 Correct 199 ms 35072 KB Output is correct
5 Correct 286 ms 34532 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 813 ms 37392 KB Output is correct
2 Correct 790 ms 36504 KB Output is correct
3 Correct 814 ms 36268 KB Output is correct
4 Correct 239 ms 37656 KB Output is correct
5 Correct 340 ms 36412 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 850 ms 36408 KB Output is correct
2 Correct 606 ms 37024 KB Output is correct
3 Correct 796 ms 37120 KB Output is correct
4 Correct 217 ms 35828 KB Output is correct
5 Correct 312 ms 36748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 944 ms 40604 KB Output is correct
2 Correct 935 ms 40608 KB Output is correct
3 Execution timed out 1002 ms 41048 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 943 ms 40752 KB Output is correct
2 Correct 660 ms 40364 KB Output is correct
3 Correct 865 ms 40364 KB Output is correct
4 Correct 293 ms 41016 KB Output is correct
5 Correct 377 ms 40880 KB Output is correct