# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1073859 |
2024-08-25T00:21:04 Z |
vjudge1 |
Mobile (BOI12_mobile) |
C++17 |
|
1000 ms |
21688 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
ld dist(ld x1, ld y1, ld x2, ld y2){
return (x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
}
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
int n;
ll L;
cin >> n >> L;
vector <pair<ll,ll>> pts;
for(int i=0; i<n; i++){
ll x, y;
cin >> x >> y;
if(!pts.empty() && x == pts.back().first){
pts.back().second = min(pts.back().second, abs(y));
}
else{
pts.push_back({x,abs(y)});
}
}
n = pts.size();
ld ans = max(
dist(pts[0].first,pts[0].second,0,0),
dist(pts[n-1].first, pts[n-1].second, L, 0));
const ld EPS = 1e-8;
auto f = [&](ld x, int i){
return max(
dist(x,0,pts[i-1].first,pts[i-1].second),
dist(x,0,pts[i].first,pts[i].second));
};
for(int i=1; i<n; i++){
// ternary search x* between pts[i-1], pts[i]
ld l=max(0LL, pts[i-1].first);
ld r=min(L, pts[i].first);
/*
for(ld xt = l; xt <= r; xt+=0.5){
cout << "xt: " << xt << ' ' << f(xt, i) << endl;
}
*/
while(r-l > EPS){
ld mid1 = l+(r-l)/3;
ld mid2 = l+2*(r-l)/3;
if(f(mid2,i)-f(mid1,i) >= 0) r = mid2;
else l = mid1;
}
ans = max(ans, f(l,i));
}
ans = sqrt(ans);
cout << fixed << setprecision(6) << ans << '\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
600 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
600 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
600 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
604 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
55 ms |
3288 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
11 ms |
1116 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
142 ms |
3032 KB |
Output is correct |
2 |
Incorrect |
52 ms |
2268 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
47 ms |
2640 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
100 ms |
3540 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
814 ms |
10948 KB |
Output is correct |
2 |
Correct |
67 ms |
4764 KB |
Output is correct |
3 |
Correct |
62 ms |
4524 KB |
Output is correct |
4 |
Incorrect |
499 ms |
13756 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
86 ms |
5156 KB |
Output is correct |
2 |
Incorrect |
424 ms |
12224 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
976 ms |
19640 KB |
Output is correct |
2 |
Incorrect |
78 ms |
5456 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
78 ms |
5716 KB |
Output is correct |
2 |
Incorrect |
499 ms |
20916 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1038 ms |
20152 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
86 ms |
6536 KB |
Output is correct |
2 |
Incorrect |
579 ms |
21688 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1038 ms |
20656 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
131 ms |
7508 KB |
Output is correct |
2 |
Incorrect |
660 ms |
16820 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1012 ms |
16820 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
126 ms |
592 KB |
Output is correct |
2 |
Incorrect |
819 ms |
16824 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |