Submission #1031373

# Submission time Handle Problem Language Result Execution time Memory
1031373 2024-07-22T18:40:10 Z Boas Mobile (BOI12_mobile) C++17
8 / 100
1000 ms 89544 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;

template <typename T1, typename T2>
using indexed_map = tree<T1, T2, less<T1>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T>
using indexed_set = indexed_map<T, null_type>;

#define loop(x, i) for (int i = 0; i < (x); i++)
#define loop1(x, i) for (int i = 1; i <= (x); i++)
#define rev(x, i) for (int i = (int)(x) - 1; i >= 0; i--)
#define itloop(x) for (auto it = begin(x); x != end(x); it++)
#define itrev(x) for (auto it = rbegin(x); x != rend(x); it++)
#define int long long
#define INF ((int64_t)(4e18 + 1))
#define INF32 ((int32_t)(2e9 + 1))
#define ALL(x) begin(x), end(x)
#define RALL(x) rbegin(x), rend(x)
#define existsIn(x, l) (count(ALL(l), x) > 0)
#define removeIn(x, l) l.erase(find(ALL(l), x))
#define pb push_back
#define sz(x) (int)(x).size()
#define x first
#define y second
#define var const auto &
#define foreach(l) for (var e : l)

typedef pair<int, int> ii;
typedef tuple<int, int, int> iii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vii> vvii;
typedef vector<viii> vviii;
typedef set<int> si;
typedef set<ii> sii;
typedef set<iii> siii;
typedef vector<si> vsi;
typedef vector<sii> vsii;
typedef vector<vsi> vvsi;
typedef vector<string> vstr;
typedef vector<vector<string>> vvstr;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vi::iterator viit;
typedef si::iterator siit;
typedef int8_t in8;
typedef int16_t in16;
typedef int32_t in32;
typedef int64_t in64;

typedef long double ld;
typedef vector<pair<ld, ld>> vff;
ld eps = 1e-6;

void solve()
{
    int N;
    ld L;
    cin >> N >> L;
    vff a(N);
    loop(N, i)
    {
        cin >> a[i].x >> a[i].y;
    }
    ld lo = 0, hi = 5e9;
    while (hi - lo > eps)
    {
        ld R = lo + (hi - lo) / 2;
        vff segments;
        loop(N, i)
        {
            auto [x, y] = a[i];
            ld D = R * R - (ld)y * (ld)y;
            if (D >= 0)
            {
                ld l = x - sqrt(D);
                ld r = x + sqrt(D);
                segments.pb({l, r});
            }
        }
        sort(ALL(segments));
        bool highwayCovered = 1;
        ld l = segments[0].first, r = segments[0].second;
        if (l > 0)
            highwayCovered = 0;
        else
        {
            for (auto [l_i, r_i] : segments)
            {
                if (l_i > r)
                {
                    highwayCovered = 0;
                    break;
                }
                r = max(r, r_i);
            }
        }
        if (r + eps < L)
            highwayCovered = 0;
        if (highwayCovered)
        {
            hi = R;
        }
        else
            lo = R;
    }
    cout << fixed << setprecision(5) << lo << endl;
}

signed main()
{
    cin.tie(0)->sync_with_stdio(0);
    solve();
}
# 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 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 796 KB Output is correct
2 Runtime error 7 ms 956 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 17 ms 1096 KB Output is correct
2 Correct 22 ms 1108 KB Output is correct
3 Correct 27 ms 1092 KB Output is correct
4 Correct 12 ms 1092 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 1092 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 11 ms 1216 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 182 ms 10072 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 263 ms 10044 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 454 ms 10624 KB Output is correct
2 Correct 561 ms 10544 KB Output is correct
3 Correct 748 ms 10708 KB Output is correct
4 Incorrect 153 ms 12020 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 595 ms 12000 KB Output is correct
2 Correct 737 ms 11884 KB Output is correct
3 Correct 955 ms 11620 KB Output is correct
4 Correct 149 ms 12036 KB Output is correct
5 Incorrect 284 ms 11616 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 516 ms 11916 KB Output is correct
2 Correct 684 ms 12148 KB Output is correct
3 Correct 926 ms 11636 KB Output is correct
4 Incorrect 148 ms 12052 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1045 ms 50536 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 52596 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1049 ms 71344 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1086 ms 73588 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1051 ms 74924 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1105 ms 77512 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1012 ms 78588 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1031 ms 81632 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1026 ms 85736 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1103 ms 89544 KB Time limit exceeded
2 Halted 0 ms 0 KB -