# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
906167 |
2024-01-13T15:07:12 Z |
Ludissey |
Mobile (BOI12_mobile) |
C++14 |
|
409 ms |
10628 KB |
#include <bits/stdc++.h>
using namespace std;
double dist(double x1, double y1, double x2, double y2){
double dist=sqrt(pow((x1-x2),2)+pow((y1-y2),2));
return dist;
}
signed main() {
ios::sync_with_stdio(false); cin.tie(nullptr);
int N,L; cin >> N >> L;
vector<pair<int,int>> a;
for (int i = 0; i < N; i++){
int x,y; cin >> x >> y;
y=abs(y);
if(i>0&&a[a.size()-1].first==x) a[a.size()-1].second=min(a[a.size()-1].second,y);
else{
a.push_back({x,y});
}
}
N=a.size();
double l=0,r=1e9;
while(r-l>0.0009){
double mid=(l+r)/2;
double rght=0;
for (int i = 0; i < a.size(); i++)
{
if(mid<(double)a[i].second) continue;
double pnt1=a[i].first-sqrt((mid*mid)-((double)a[i].second*(double)a[i].second)),pnt2=(double)a[i].first+sqrt((mid*mid)-((double)a[i].second*(double)a[i].second));
if(pnt1<=rght) rght=max(rght, pnt2);
}
if(rght>=L) {
r=mid;
}else{
l=mid;
}
}
cout << setprecision(3) << fixed << l << "\n";
return 0;
}
Compilation message
mobile.cpp: In function 'int main()':
mobile.cpp:26:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
26 | for (int i = 0; i < a.size(); i++)
| ~~^~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
600 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
2 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
2 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
348 KB |
Output is correct |
2 |
Correct |
2 ms |
520 KB |
Output is correct |
3 |
Correct |
1 ms |
600 KB |
Output is correct |
4 |
Correct |
2 ms |
380 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
344 KB |
Output is correct |
2 |
Correct |
3 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
3 ms |
516 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
344 KB |
Output is correct |
2 |
Correct |
2 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
2 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
32 ms |
1500 KB |
Output is correct |
2 |
Correct |
25 ms |
988 KB |
Output is correct |
3 |
Correct |
18 ms |
988 KB |
Output is correct |
4 |
Correct |
22 ms |
1500 KB |
Output is correct |
5 |
Correct |
6 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
344 KB |
Output is correct |
2 |
Correct |
17 ms |
1028 KB |
Output is correct |
3 |
Correct |
25 ms |
1500 KB |
Output is correct |
4 |
Correct |
23 ms |
1752 KB |
Output is correct |
5 |
Correct |
22 ms |
1500 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
29 ms |
1500 KB |
Output is correct |
2 |
Correct |
25 ms |
988 KB |
Output is correct |
3 |
Correct |
25 ms |
1500 KB |
Output is correct |
4 |
Correct |
24 ms |
1500 KB |
Output is correct |
5 |
Correct |
15 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
988 KB |
Output is correct |
2 |
Correct |
24 ms |
992 KB |
Output is correct |
3 |
Correct |
15 ms |
604 KB |
Output is correct |
4 |
Correct |
31 ms |
1496 KB |
Output is correct |
5 |
Correct |
29 ms |
1500 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
38 ms |
1500 KB |
Output is correct |
2 |
Correct |
24 ms |
992 KB |
Output is correct |
3 |
Correct |
15 ms |
600 KB |
Output is correct |
4 |
Correct |
24 ms |
1496 KB |
Output is correct |
5 |
Correct |
35 ms |
1496 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
172 ms |
5520 KB |
Output is correct |
2 |
Correct |
73 ms |
592 KB |
Output is correct |
3 |
Correct |
74 ms |
592 KB |
Output is correct |
4 |
Correct |
116 ms |
5008 KB |
Output is correct |
5 |
Correct |
124 ms |
6600 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
73 ms |
516 KB |
Output is correct |
2 |
Correct |
214 ms |
6276 KB |
Output is correct |
3 |
Correct |
75 ms |
1492 KB |
Output is correct |
4 |
Correct |
115 ms |
5836 KB |
Output is correct |
5 |
Correct |
123 ms |
6072 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
203 ms |
10268 KB |
Output is correct |
2 |
Correct |
92 ms |
508 KB |
Output is correct |
3 |
Correct |
76 ms |
800 KB |
Output is correct |
4 |
Correct |
140 ms |
10628 KB |
Output is correct |
5 |
Correct |
143 ms |
4572 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
80 ms |
604 KB |
Output is correct |
2 |
Correct |
250 ms |
10436 KB |
Output is correct |
3 |
Correct |
78 ms |
1492 KB |
Output is correct |
4 |
Correct |
138 ms |
9284 KB |
Output is correct |
5 |
Correct |
147 ms |
9312 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
237 ms |
10180 KB |
Output is correct |
2 |
Correct |
92 ms |
552 KB |
Output is correct |
3 |
Correct |
100 ms |
344 KB |
Output is correct |
4 |
Correct |
190 ms |
9148 KB |
Output is correct |
5 |
Correct |
167 ms |
5780 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
93 ms |
348 KB |
Output is correct |
2 |
Correct |
291 ms |
8900 KB |
Output is correct |
3 |
Correct |
108 ms |
1524 KB |
Output is correct |
4 |
Correct |
165 ms |
10432 KB |
Output is correct |
5 |
Correct |
178 ms |
10576 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
273 ms |
9404 KB |
Output is correct |
2 |
Correct |
101 ms |
348 KB |
Output is correct |
3 |
Correct |
106 ms |
600 KB |
Output is correct |
4 |
Correct |
181 ms |
10376 KB |
Output is correct |
5 |
Correct |
186 ms |
5068 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
107 ms |
496 KB |
Output is correct |
2 |
Correct |
316 ms |
9192 KB |
Output is correct |
3 |
Correct |
117 ms |
1496 KB |
Output is correct |
4 |
Correct |
181 ms |
10056 KB |
Output is correct |
5 |
Correct |
192 ms |
9664 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
333 ms |
8900 KB |
Output is correct |
2 |
Correct |
154 ms |
592 KB |
Output is correct |
3 |
Correct |
149 ms |
348 KB |
Output is correct |
4 |
Correct |
233 ms |
9548 KB |
Output is correct |
5 |
Correct |
209 ms |
5540 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
132 ms |
344 KB |
Output is correct |
2 |
Correct |
409 ms |
10332 KB |
Output is correct |
3 |
Correct |
143 ms |
2508 KB |
Output is correct |
4 |
Correct |
224 ms |
9920 KB |
Output is correct |
5 |
Correct |
252 ms |
9248 KB |
Output is correct |