//#pragma GCC optimize("O3,unroll-loops,Ofast")
//#pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
// using namespace __gnu_pbds;
#define MAX 200005
#define pb push_back
#define mp make_pair
#define int long long
#define f first
#define s second
#define vi vector<int>
#define pii pair<int,int>
#define si set<int>
#define vpii vector<pair<int,int>>
const int mod = 1e9+7;
const int INF = 1e18;
// myMap.begin()->first : key
// myMap.begin()->second : value
//#define double double
int epow(int a,int b){int ans=1;while(b){if(b&1) ans*=a;a*=a;b>>=1;a%=mod;ans%=mod;}return ans%=mod;}
int gcd(int a,int b) {if(a<b)swap(a,b);while(b){int tmp=b;b=a%b;a=tmp;}return a;}
int mul(long long a,long long b){return ((a%mod)*(b%mod))%mod;}
int sum(long long a,long long b){return ((a%mod)+(b%mod))%mod;}
// typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
// typedef
// tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_multiset;
void solve(){
int n,L; cin>>n>>L;
vpii v(n+2); for(int i=1;i<=n;i++) cin>>v[i].f>>v[i].s;
double l=0,r=2e9;
while(r-l>1e-6){
vector<pair<double,double>> arr;
double mid=(l+r)/2.0;
for(int i=1;i<=n;i++){
if(v[i].s*v[i].s>mid*mid) continue;
double a = sqrt(mid*mid-v[i].s*v[i].s);
arr.pb({v[i].f-a,v[i].f+a});
}
sort(arr.begin(),arr.end(),[&](auto l, auto r){return l.s < r.s;});
double mx=0.0;
for(auto u : arr){
if(u.f<=mx) mx=max(mx,u.s);
}
if(mx<(double)L) l=mid;
else r=mid;
}
cout << fixed << setprecision(6);
cout<<l<<endl;
return;
}
int32_t main(/*int32_t argc, char* argv[]*/){
ios_base::sync_with_stdio(0); cin.tie(0);
// freopen("dining.in", "r", stdin);
// freopen("dining.out", "w", stdout);
int t=1;
// cin >> t;
while (t--) solve();
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
592 KB |
Output is correct |
2 |
Correct |
3 ms |
592 KB |
Output is correct |
3 |
Correct |
2 ms |
336 KB |
Output is correct |
4 |
Correct |
4 ms |
592 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
736 KB |
Output is correct |
2 |
Correct |
8 ms |
764 KB |
Output is correct |
3 |
Correct |
7 ms |
736 KB |
Output is correct |
4 |
Correct |
7 ms |
736 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
752 KB |
Output is correct |
2 |
Correct |
8 ms |
752 KB |
Output is correct |
3 |
Correct |
7 ms |
736 KB |
Output is correct |
4 |
Correct |
5 ms |
736 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
752 KB |
Output is correct |
2 |
Correct |
9 ms |
752 KB |
Output is correct |
3 |
Correct |
7 ms |
736 KB |
Output is correct |
4 |
Correct |
5 ms |
720 KB |
Output is correct |
5 |
Correct |
6 ms |
748 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
113 ms |
4920 KB |
Output is correct |
2 |
Correct |
279 ms |
4980 KB |
Output is correct |
3 |
Correct |
99 ms |
3216 KB |
Output is correct |
4 |
Correct |
90 ms |
4892 KB |
Output is correct |
5 |
Correct |
82 ms |
3176 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
125 ms |
4984 KB |
Output is correct |
2 |
Correct |
94 ms |
5620 KB |
Output is correct |
3 |
Correct |
107 ms |
5020 KB |
Output is correct |
4 |
Correct |
88 ms |
5064 KB |
Output is correct |
5 |
Correct |
79 ms |
5224 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
208 ms |
5408 KB |
Output is correct |
2 |
Correct |
323 ms |
5132 KB |
Output is correct |
3 |
Correct |
110 ms |
5156 KB |
Output is correct |
4 |
Correct |
62 ms |
5568 KB |
Output is correct |
5 |
Correct |
138 ms |
5304 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
313 ms |
5700 KB |
Output is correct |
2 |
Correct |
380 ms |
5664 KB |
Output is correct |
3 |
Correct |
217 ms |
5664 KB |
Output is correct |
4 |
Correct |
69 ms |
5568 KB |
Output is correct |
5 |
Correct |
138 ms |
5748 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
238 ms |
5720 KB |
Output is correct |
2 |
Correct |
392 ms |
5680 KB |
Output is correct |
3 |
Correct |
206 ms |
5664 KB |
Output is correct |
4 |
Correct |
64 ms |
5568 KB |
Output is correct |
5 |
Correct |
131 ms |
5656 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
934 ms |
24368 KB |
Output is correct |
2 |
Execution timed out |
1052 ms |
24312 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1065 ms |
24332 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1052 ms |
36432 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1063 ms |
37560 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1064 ms |
40464 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1051 ms |
39972 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1045 ms |
42068 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1049 ms |
42760 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1044 ms |
48224 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1057 ms |
48244 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |