#include <bits/stdc++.h>
#define endl "\n"
#define F first
#define S second
#define pb push_back
#define all(x) x.begin() , x.end()
#define mm1(dp) memset (dp , -1 , sizeof dp)
#define mm0(dp) memset (dp , 0 , sizeof dp)
#define mmo(dp) memset (dp , oo , sizeof dp)
//#define mid ((r+l)/2.0)
#define lx (n<<1)
#define rx ((n<<1)|1)
typedef long long ll;
using namespace std;
const int N = 1e6+5;
const int MOD = 1e9+7;
const long long oo = 4557430888798830399 ;
ll n , le ;
double x[N] , y[N] ;
bool ch(double m)
{
double la = 0 ;
for (int i = 0 ; i<n ; i++)
{
double p = sqrt((m*m) - (y[i]*y[i]));
// cout << p << " " << x[i] - p << " " << la << endl ;
if (x[i]-p <= la)
{
la = x[i]+p;
if (la>=le)
return true ;
}
else
{
return false ;
}
}
return (la>=le ? true : false) ;
}
int main()
{
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin >> n >> le ;
for (int i = 0 ; i<n ; i++)
{
cin >> x[i] >> y[i] ;
}
double l = 0 , r = 1e18 ;
while (r-l > 0.0000001)
{
double mid = (r+l)/2.0 ;
if (ch(mid))
{
r = mid ;
}
else
{
l = mid ;
}
}
cout <<fixed << setprecision(6) << r << endl ;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
468 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
412 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
40 ms |
2344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
33 ms |
2292 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
45 ms |
2280 KB |
Output is correct |
2 |
Incorrect |
38 ms |
2760 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
49 ms |
3376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
58 ms |
3332 KB |
Output is correct |
2 |
Incorrect |
46 ms |
3248 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
256 ms |
12416 KB |
Output is correct |
2 |
Correct |
244 ms |
15980 KB |
Output is correct |
3 |
Correct |
231 ms |
15336 KB |
Output is correct |
4 |
Incorrect |
297 ms |
17608 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
253 ms |
16268 KB |
Output is correct |
2 |
Incorrect |
251 ms |
14760 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
379 ms |
14796 KB |
Output is correct |
2 |
Incorrect |
303 ms |
18960 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
334 ms |
19580 KB |
Output is correct |
2 |
Incorrect |
364 ms |
17580 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
409 ms |
17328 KB |
Output is correct |
2 |
Incorrect |
364 ms |
22036 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
366 ms |
22740 KB |
Output is correct |
2 |
Incorrect |
354 ms |
20532 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
420 ms |
19788 KB |
Output is correct |
2 |
Incorrect |
406 ms |
25208 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
401 ms |
25984 KB |
Output is correct |
2 |
Incorrect |
490 ms |
23372 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
525 ms |
24612 KB |
Output is correct |
2 |
Incorrect |
478 ms |
31412 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
516 ms |
32528 KB |
Output is correct |
2 |
Incorrect |
543 ms |
29180 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |