# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1031383 |
2024-07-22T18:54:06 Z |
Boas |
Mobile (BOI12_mobile) |
C++17 |
|
1000 ms |
48192 KB |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#pragma GCC optimize("trapv")
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 double ld;
typedef vector<pair<ld, ld>> vff;
ld eps = 3e-4; // 13pt
// ld eps = 1e-8; // 13pt
// ld eps = 1e-18; // 4pt: TLE
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.0L, hi = 5e9L;
while (hi - lo > eps)
{
ld R = lo + (hi - lo) / 2.0L;
vff segments;
loop(N, i)
{
auto [x, y] = a[i];
ld D = R * R - (ld)y * (ld)y;
if (D >= 0.0L)
{
ld l = x - sqrt(D);
ld r = x + sqrt(D);
segments.pb({l, r});
}
else if (D + eps >= 0.0L)
{
ld l = x;
ld r = x;
segments.pb({l, r});
}
}
if (segments.empty())
{
lo = R;
continue;
}
sort(ALL(segments));
bool highwayCovered = 1;
ld l = segments[0].first, r = segments[0].second;
if (l > eps)
highwayCovered = 0;
else
{
for (auto [l_i, r_i] : segments)
{
if (l_i > r + eps)
{
highwayCovered = 0;
break;
}
r = max(r, r_i);
}
}
if (r + eps < L)
highwayCovered = 0;
if (highwayCovered)
{
hi = R;
}
else
lo = R;
}
cout << fixed << setprecision(4) << lo << endl;
}
signed main()
{
cin.tie(0)->sync_with_stdio(0);
solve();
}
# |
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 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
604 KB |
Output is correct |
2 |
Correct |
4 ms |
604 KB |
Output is correct |
3 |
Incorrect |
3 ms |
348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
748 KB |
Output is correct |
2 |
Correct |
8 ms |
744 KB |
Output is correct |
3 |
Correct |
12 ms |
748 KB |
Output is correct |
4 |
Correct |
7 ms |
716 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
744 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
748 KB |
Output is correct |
2 |
Correct |
8 ms |
756 KB |
Output is correct |
3 |
Correct |
12 ms |
744 KB |
Output is correct |
4 |
Correct |
6 ms |
732 KB |
Output is correct |
5 |
Correct |
10 ms |
752 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
136 ms |
4884 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
151 ms |
5228 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
185 ms |
5312 KB |
Output is correct |
2 |
Correct |
252 ms |
5108 KB |
Output is correct |
3 |
Correct |
293 ms |
5184 KB |
Output is correct |
4 |
Incorrect |
112 ms |
5556 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
254 ms |
5688 KB |
Output is correct |
2 |
Correct |
310 ms |
5664 KB |
Output is correct |
3 |
Correct |
346 ms |
5676 KB |
Output is correct |
4 |
Correct |
113 ms |
7548 KB |
Output is correct |
5 |
Incorrect |
161 ms |
6940 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
197 ms |
5688 KB |
Output is correct |
2 |
Correct |
332 ms |
5672 KB |
Output is correct |
3 |
Correct |
357 ms |
5664 KB |
Output is correct |
4 |
Incorrect |
110 ms |
7608 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
833 ms |
24716 KB |
Output is correct |
2 |
Execution timed out |
1051 ms |
32048 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1035 ms |
24328 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1054 ms |
35784 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1046 ms |
36196 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1032 ms |
40108 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1022 ms |
39404 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1058 ms |
43952 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1035 ms |
41932 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1054 ms |
48192 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1052 ms |
48168 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |