//#pragma GCC optimize("03,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
// Shortcuts for common operations
#define pb push_back
#define p push
#define ppb pop_back
#define f first
#define s second
#define all(x) (x).begin(), (x).end()
#define ll long long
//#define int ll
#define endl "\n"
#define sz(x) (int)x.size()
// Type definitions for convenience
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<vi> vvi;
typedef vector<pii> vii;
// Debugging macros
#define debug(x) cerr << #x << " = " << (x) << '\n'
#define debug_vector(v) _debug_vector(#v, v)
template<typename T>
void _debug_vector(const string& name, const vector<T>& a) {
cerr << name << " = [ ";
for(const auto &x : a) cerr << x << ' ';
cerr << "]\n";
}
// I/O redirection for local testing
#define iofile(io) \
freopen((io + ".in").c_str(), "r", stdin); \
freopen((io + ".out").c_str(), "w", stdout);
// delta for floodfill
vi dx = {0, 1, 0, -1};
vi dy = {1, 0, -1, 0};
// extended deltas for floodfill
vi edx = {0, 1, 0, -1, 1, 1, -1, -1};
vi edy = {1, 0, -1, 0, 1, -1, 1, -1};
// Common outputs
void yes() { cout << "YES" << '\n'; }
void no() { cout << "NO" << '\n'; }
#define ld long double
vector<pair<ld, ld>> tab;
int n;
ld l;
ld eps = 0.000001;
bool check(ld alpha){
stack<pair<ld, ld>>s;
for(int i = 0; i < n; i++){
auto [x, y] = tab[i];
if(abs(y) > alpha) continue;
ld A = max(((ld)0), x - sqrt(alpha*alpha - y*y));
ld B = min(l, x + sqrt(alpha*alpha - y*y));
s.push({A, B});
while(s.size() >= 2){
auto [a, b] = s.top();
s.pop();
if(s.top().s >= a) s.top().f = max(((ld)0), min(s.top().f, a)), s.top().s = min(l, max(s.top().s, b));
else{ s.push({a, b}); break; }
}
}
return (s.size() == 1 and s.top().f <= eps and s.top().s >= l-eps);
}
void fx() {
cin >> n >> l;
for(int i = 0; i < n; i++){
pair<ld, ld>curr;
cin >> curr.f >> curr.s;
tab.pb(curr);
}
ld lo = 0;
ld hi = 1e10;
for(int iter = 0; iter < 45; iter++){
ld mid = (lo + hi)/2;
if(check(mid)) hi = mid;
else lo = mid;
}
cout << fixed << setprecision(8) << lo << endl;
}
signed main() {
cin.tie(0)->sync_with_stdio(0);
// Uncomment the following lines for file I/O
// iofile(string("hello"));
// Uncomment the following lines for multiple test cases
// int t; cin >> t; while(t--) fx();
// Single test case
fx();
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
6 ms |
600 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
11 ms |
860 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
11 ms |
860 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
12 ms |
856 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
193 ms |
5800 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
180 ms |
5068 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
169 ms |
4688 KB |
Output is correct |
2 |
Correct |
173 ms |
5940 KB |
Output is correct |
3 |
Correct |
144 ms |
5844 KB |
Output is correct |
4 |
Incorrect |
254 ms |
5320 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
199 ms |
6092 KB |
Output is correct |
2 |
Correct |
197 ms |
5844 KB |
Output is correct |
3 |
Correct |
171 ms |
6100 KB |
Output is correct |
4 |
Incorrect |
236 ms |
6440 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
231 ms |
5332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1000 ms |
19060 KB |
Output is correct |
2 |
Correct |
990 ms |
22712 KB |
Output is correct |
3 |
Correct |
987 ms |
21936 KB |
Output is correct |
4 |
Execution timed out |
1098 ms |
23824 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1025 ms |
18612 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1043 ms |
33452 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1022 ms |
34240 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1022 ms |
34460 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1022 ms |
34992 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1047 ms |
33412 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1050 ms |
34800 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1020 ms |
33704 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1089 ms |
33964 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |