# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
973225 |
2024-05-01T16:23:42 Z |
HuyAT |
Mobile (BOI12_mobile) |
C++14 |
|
992 ms |
31980 KB |
#include<bits/stdc++.h>
const int MaxN = 1e6 + 10;
const long double Eps = 1e-4;
const long double MaxV = 1e9;
int n;
long double length,x[MaxN + 1],y[MaxN + 1];
void readData(){
std::cin >> n >> length;
for(int i = 1;i <= n;++i){
std::cin >> x[i] >> y[i];
}
}
bool f(long double mid){
long double l = 0,r = 0;
for(int i = 1;i <= n;++i){
if(mid < y[i]){
continue;
}
long double distance = sqrt(mid * mid - y[i] * y[i]);
if(x[i] - distance <= r && x[i] + distance >= l){
l = std::min(l,x[i] - distance);
r = std::max(r,x[i] + distance);
}
}
return (l <= 0 && r >= length);
}
long double solve(long double lo,long double hi){
while(hi - lo > Eps){
long double mid = (lo + hi) / 2;
if(f(mid)){
hi = mid;
}else{
lo = mid;
}
// std::cerr << mid << "\n";
}
return hi;
}
int main(){
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);std::cout.tie(nullptr);
readData();
std::cout << std::fixed << std::setprecision(8) << solve(0,MaxV * 2);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2392 KB |
Output is correct |
4 |
Correct |
1 ms |
2396 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2392 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
2392 KB |
Output is correct |
2 |
Correct |
2 ms |
2392 KB |
Output is correct |
3 |
Correct |
2 ms |
2396 KB |
Output is correct |
4 |
Correct |
2 ms |
2528 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
2396 KB |
Output is correct |
2 |
Correct |
4 ms |
2392 KB |
Output is correct |
3 |
Correct |
4 ms |
2396 KB |
Output is correct |
4 |
Correct |
5 ms |
2396 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
2396 KB |
Output is correct |
2 |
Correct |
4 ms |
2396 KB |
Output is correct |
3 |
Correct |
4 ms |
2396 KB |
Output is correct |
4 |
Correct |
6 ms |
2396 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
2396 KB |
Output is correct |
2 |
Correct |
4 ms |
2392 KB |
Output is correct |
3 |
Correct |
4 ms |
2648 KB |
Output is correct |
4 |
Correct |
5 ms |
2396 KB |
Output is correct |
5 |
Correct |
4 ms |
2396 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
51 ms |
6748 KB |
Output is correct |
2 |
Correct |
53 ms |
6748 KB |
Output is correct |
3 |
Correct |
35 ms |
4696 KB |
Output is correct |
4 |
Correct |
69 ms |
6748 KB |
Output is correct |
5 |
Correct |
36 ms |
4696 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
59 ms |
6748 KB |
Output is correct |
2 |
Correct |
74 ms |
6740 KB |
Output is correct |
3 |
Correct |
73 ms |
6780 KB |
Output is correct |
4 |
Correct |
74 ms |
6740 KB |
Output is correct |
5 |
Correct |
93 ms |
6548 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
66 ms |
6748 KB |
Output is correct |
2 |
Correct |
57 ms |
6744 KB |
Output is correct |
3 |
Correct |
67 ms |
6792 KB |
Output is correct |
4 |
Correct |
100 ms |
6748 KB |
Output is correct |
5 |
Correct |
72 ms |
6792 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
63 ms |
6788 KB |
Output is correct |
2 |
Correct |
68 ms |
6780 KB |
Output is correct |
3 |
Correct |
67 ms |
6748 KB |
Output is correct |
4 |
Correct |
97 ms |
6748 KB |
Output is correct |
5 |
Correct |
89 ms |
6792 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
72 ms |
7000 KB |
Output is correct |
2 |
Correct |
75 ms |
6792 KB |
Output is correct |
3 |
Correct |
63 ms |
6744 KB |
Output is correct |
4 |
Correct |
98 ms |
6788 KB |
Output is correct |
5 |
Correct |
88 ms |
6748 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
386 ms |
19284 KB |
Output is correct |
2 |
Correct |
346 ms |
19028 KB |
Output is correct |
3 |
Correct |
368 ms |
19100 KB |
Output is correct |
4 |
Correct |
487 ms |
19104 KB |
Output is correct |
5 |
Correct |
458 ms |
19348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
312 ms |
19024 KB |
Output is correct |
2 |
Correct |
349 ms |
19024 KB |
Output is correct |
3 |
Correct |
319 ms |
19080 KB |
Output is correct |
4 |
Correct |
483 ms |
19336 KB |
Output is correct |
5 |
Correct |
453 ms |
19024 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
469 ms |
23172 KB |
Output is correct |
2 |
Correct |
411 ms |
23172 KB |
Output is correct |
3 |
Correct |
445 ms |
23436 KB |
Output is correct |
4 |
Correct |
596 ms |
23188 KB |
Output is correct |
5 |
Correct |
540 ms |
23384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
386 ms |
23208 KB |
Output is correct |
2 |
Correct |
408 ms |
23120 KB |
Output is correct |
3 |
Correct |
379 ms |
23124 KB |
Output is correct |
4 |
Correct |
596 ms |
23436 KB |
Output is correct |
5 |
Correct |
550 ms |
23188 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
545 ms |
25256 KB |
Output is correct |
2 |
Correct |
487 ms |
25248 KB |
Output is correct |
3 |
Correct |
511 ms |
25492 KB |
Output is correct |
4 |
Correct |
680 ms |
25496 KB |
Output is correct |
5 |
Correct |
612 ms |
25252 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
471 ms |
25428 KB |
Output is correct |
2 |
Correct |
456 ms |
25224 KB |
Output is correct |
3 |
Correct |
461 ms |
25424 KB |
Output is correct |
4 |
Correct |
690 ms |
25476 KB |
Output is correct |
5 |
Correct |
659 ms |
25256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
606 ms |
29264 KB |
Output is correct |
2 |
Correct |
550 ms |
29356 KB |
Output is correct |
3 |
Correct |
602 ms |
29544 KB |
Output is correct |
4 |
Correct |
788 ms |
29576 KB |
Output is correct |
5 |
Correct |
725 ms |
29520 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
547 ms |
29360 KB |
Output is correct |
2 |
Correct |
523 ms |
29344 KB |
Output is correct |
3 |
Correct |
551 ms |
29360 KB |
Output is correct |
4 |
Correct |
828 ms |
29364 KB |
Output is correct |
5 |
Correct |
773 ms |
29356 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
779 ms |
31568 KB |
Output is correct |
2 |
Correct |
744 ms |
31760 KB |
Output is correct |
3 |
Correct |
718 ms |
31900 KB |
Output is correct |
4 |
Correct |
979 ms |
31760 KB |
Output is correct |
5 |
Correct |
907 ms |
31756 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
634 ms |
31756 KB |
Output is correct |
2 |
Correct |
678 ms |
31756 KB |
Output is correct |
3 |
Correct |
672 ms |
31980 KB |
Output is correct |
4 |
Correct |
992 ms |
31668 KB |
Output is correct |
5 |
Correct |
941 ms |
31756 KB |
Output is correct |