Submission #1093457

# Submission time Handle Problem Language Result Execution time Memory
1093457 2024-09-26T20:33:10 Z selmahbn Mobile (BOI12_mobile) C++17
0 / 100
627 ms 48240 KB
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define pdl pair<double, ll>

double sp(double x1, double y1, double x2, double y2) {
    double top = x2*x2 - x1*x1 + y2*y2 - y1*y1;
    double bottom = 2*x2 - 2*x1;
    return top/bottom;
}

int main()
{
    ll n; double l;
    cin >> n >> l;
    vector<pdl> p(n);
    ll li = -1;
    vector<double> x(n);
    vector<double> y(n);
    for (ll i = 0; i < n; i++) {
        cin >> x[i] >> y[i];
        double last;
        while (li >= 0) {
            double lsp, i2;
            tie(lsp, i2) = p[li];
            double csp = sp(x[i], y[i], x[i2], y[i2]);
            if (csp <= lsp) {
                li--;
            } else {
                last = csp;
                break;
            }
        }
        if (li == -1) p[0] = make_pair(0, i);
        else p[li+1] = make_pair(last, i);
        li++;
    }
    double maxi = 0;
    ll last = p[0].second;
    for (ll i = 0; i <= li; i++) {
        double csp, ci;
        tie(csp, ci) = p[i];
        if (csp > l || i == li) {
            if (i == li) last = ci;
            double dist = sqrt((x[last]-l)*(x[last]-l)+y[last]*y[last]);
            maxi = max(maxi, dist);
        }
        double dist = sqrt((x[ci]-csp)*(x[ci]-csp)+y[ci]*y[ci]);
        maxi = max(maxi, dist);
        last = ci;
    }
    cout << maxi;
    return 0;
}
# 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 348 KB Expected double, but "inf" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 536 KB Expected double, but "inf" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 604 KB Expected double, but "inf" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 604 KB Expected double, but "inf" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 36 ms 3540 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 39 ms 3508 KB Expected double, but "inf" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 36 ms 3676 KB Output is correct
2 Incorrect 60 ms 4160 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 62 ms 4948 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 68 ms 4968 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 218 ms 20308 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 329 ms 24144 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 285 ms 24188 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 381 ms 28936 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 312 ms 28244 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 434 ms 33876 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 343 ms 32248 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 505 ms 38524 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 447 ms 40444 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 627 ms 48240 KB Output isn't correct
2 Halted 0 ms 0 KB -