#include <bits/stdc++.h>
using namespace std;
void setIO(string fileName = ""){
ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
if(fileName.length()){
freopen((fileName+".in").c_str(), "r", stdin);
freopen((fileName+".out").c_str(), "w", stdout);
}
}
#define ll long long
#define ld long double
#define FOR(i,a,b) for(__typeof(b) i=a; i<=b; i++)
#define FOD(i,a,b) for(__typeof(b) i=b; i>=a; i--)
#define EACH(u, v) for(auto& u : v)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define ii pair<int,int>
#define iii pair<int,ii>
#define ld2 pair<ld, ld>
#define ll2 pair<ll, ll>
#define X first
#define Y second
#define ed "\n"
#define sp " "
const int oo = 1e9 + 7;
const int N = 1e6 + 10;
int n, len;
ll2 a[N];
void solve()
{
cin >> n >> len;
FOR(i, 1, n) cin >> a[i].X >> a[i].Y;
double l = 1, r = 1.5e9;
while(r - l > 1e-3) {
double m = (l + r) * 0.5, cur = 0;
FOR(i, 1, n) {
double delta = sqrt(m * m - a[i].Y * a[i].Y);
double x = a[i].X - delta, y = a[i].X + delta;
if(x <= cur) cur = max(cur, y);
}
if(cur >= len) r = m;
else l = m;
}
cout << fixed << setprecision(6) << l;
}
int main()
{
//setIO("");
int t;
t = 1;
//cin >> t;
FOR(i, 1, t) {
solve();
}
return 0;
}
Compilation message
mobile.cpp: In function 'void setIO(std::string)':
mobile.cpp:8:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
8 | freopen((fileName+".in").c_str(), "r", stdin);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mobile.cpp:9:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
9 | freopen((fileName+".out").c_str(), "w", stdout);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
332 KB |
Output is correct |
2 |
Correct |
2 ms |
332 KB |
Output is correct |
3 |
Correct |
2 ms |
332 KB |
Output is correct |
4 |
Correct |
3 ms |
332 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
332 KB |
Output is correct |
2 |
Correct |
6 ms |
436 KB |
Output is correct |
3 |
Correct |
5 ms |
332 KB |
Output is correct |
4 |
Correct |
7 ms |
372 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
332 KB |
Output is correct |
2 |
Correct |
5 ms |
332 KB |
Output is correct |
3 |
Correct |
4 ms |
332 KB |
Output is correct |
4 |
Correct |
6 ms |
264 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
332 KB |
Output is correct |
2 |
Correct |
5 ms |
332 KB |
Output is correct |
3 |
Correct |
4 ms |
332 KB |
Output is correct |
4 |
Correct |
6 ms |
332 KB |
Output is correct |
5 |
Correct |
4 ms |
332 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
80 ms |
1348 KB |
Output is correct |
2 |
Correct |
69 ms |
1376 KB |
Output is correct |
3 |
Correct |
43 ms |
1088 KB |
Output is correct |
4 |
Correct |
79 ms |
1464 KB |
Output is correct |
5 |
Correct |
37 ms |
1016 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
62 ms |
1420 KB |
Output is correct |
2 |
Correct |
62 ms |
1276 KB |
Output is correct |
3 |
Correct |
73 ms |
1464 KB |
Output is correct |
4 |
Correct |
80 ms |
1508 KB |
Output is correct |
5 |
Correct |
91 ms |
1604 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
68 ms |
1604 KB |
Output is correct |
2 |
Correct |
73 ms |
1472 KB |
Output is correct |
3 |
Correct |
71 ms |
1600 KB |
Output is correct |
4 |
Correct |
117 ms |
1776 KB |
Output is correct |
5 |
Correct |
74 ms |
1624 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
92 ms |
1840 KB |
Output is correct |
2 |
Correct |
90 ms |
1836 KB |
Output is correct |
3 |
Correct |
76 ms |
1820 KB |
Output is correct |
4 |
Correct |
116 ms |
1800 KB |
Output is correct |
5 |
Correct |
94 ms |
1804 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
92 ms |
1780 KB |
Output is correct |
2 |
Correct |
92 ms |
1732 KB |
Output is correct |
3 |
Correct |
78 ms |
1732 KB |
Output is correct |
4 |
Correct |
115 ms |
1760 KB |
Output is correct |
5 |
Correct |
91 ms |
1732 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
362 ms |
8220 KB |
Output is correct |
2 |
Correct |
514 ms |
8204 KB |
Output is correct |
3 |
Correct |
444 ms |
8104 KB |
Output is correct |
4 |
Correct |
576 ms |
8172 KB |
Output is correct |
5 |
Correct |
520 ms |
8056 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
477 ms |
8080 KB |
Output is correct |
2 |
Correct |
519 ms |
8128 KB |
Output is correct |
3 |
Correct |
410 ms |
8004 KB |
Output is correct |
4 |
Correct |
560 ms |
8104 KB |
Output is correct |
5 |
Correct |
495 ms |
8004 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
426 ms |
9668 KB |
Output is correct |
2 |
Correct |
554 ms |
9776 KB |
Output is correct |
3 |
Correct |
535 ms |
9780 KB |
Output is correct |
4 |
Correct |
697 ms |
9672 KB |
Output is correct |
5 |
Correct |
571 ms |
9564 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
574 ms |
9960 KB |
Output is correct |
2 |
Correct |
633 ms |
9796 KB |
Output is correct |
3 |
Correct |
499 ms |
9612 KB |
Output is correct |
4 |
Correct |
718 ms |
9740 KB |
Output is correct |
5 |
Correct |
587 ms |
9660 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
501 ms |
11236 KB |
Output is correct |
2 |
Correct |
653 ms |
11236 KB |
Output is correct |
3 |
Correct |
641 ms |
11304 KB |
Output is correct |
4 |
Correct |
835 ms |
11340 KB |
Output is correct |
5 |
Correct |
646 ms |
11316 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
670 ms |
11220 KB |
Output is correct |
2 |
Correct |
696 ms |
11440 KB |
Output is correct |
3 |
Correct |
581 ms |
11220 KB |
Output is correct |
4 |
Correct |
800 ms |
11236 KB |
Output is correct |
5 |
Correct |
685 ms |
11328 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
579 ms |
12740 KB |
Output is correct |
2 |
Correct |
761 ms |
13112 KB |
Output is correct |
3 |
Correct |
716 ms |
12812 KB |
Output is correct |
4 |
Correct |
921 ms |
12804 KB |
Output is correct |
5 |
Correct |
765 ms |
13128 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
787 ms |
12740 KB |
Output is correct |
2 |
Correct |
801 ms |
12768 KB |
Output is correct |
3 |
Correct |
655 ms |
12896 KB |
Output is correct |
4 |
Correct |
909 ms |
12868 KB |
Output is correct |
5 |
Correct |
793 ms |
12820 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
715 ms |
16020 KB |
Output is correct |
2 |
Correct |
921 ms |
16020 KB |
Output is correct |
3 |
Correct |
889 ms |
15876 KB |
Output is correct |
4 |
Execution timed out |
1099 ms |
15812 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
968 ms |
16016 KB |
Output is correct |
2 |
Correct |
985 ms |
16064 KB |
Output is correct |
3 |
Correct |
856 ms |
15864 KB |
Output is correct |
4 |
Execution timed out |
1093 ms |
16012 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |