# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
593010 |
2022-07-10T07:21:38 Z |
hail |
Mobile (BOI12_mobile) |
C++17 |
|
1000 ms |
74712 KB |
#include <bits/stdc++.h>
using namespace std;
using pld = pair<long double, long double>;
using ld = long double;
#define mp make_pair
int n;
ld l;
vector<pld> station;
pld intercept(pld coor, ld r)
{
ld mid = pow(r, 2)-pow(coor.second, 2);
ld rt_mid = pow(mid, 0.5);
if (mid<0) return mp(-1, -1);
else return mp(coor.first-rt_mid, coor.first+rt_mid);
}
bool check_dist(ld r)
{
pld ret_int;
vector<pld> intercepts(0);
for(auto i: station)
{
ret_int = intercept(i, r);
if(ret_int.second<0 || ret_int.first>l) continue;
else intercepts.push_back(ret_int);
}
ld start=0;
sort(intercepts.begin(), intercepts.end());
int pos[0];
for(auto i: intercepts)
{
if(i.first>start) return false;
else start= max(start, i.second);
if(start>=l) return true;
}
return false;
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout<<setprecision(11);
cin>>n>>l;
station.resize(n);
for(int i=0; i<n; i++)
{
cin>>station[i].first>>station[i].second;
}
ld high=2e9;
ld low=0;
ld mid;
while(high-low>1e-3)
{
mid=(high+low)/2;
if(check_dist(mid)) high=mid;
else low=mid;
}
cout<<high;
}
Compilation message
mobile.cpp: In function 'bool check_dist(ld)':
mobile.cpp:39:9: warning: unused variable 'pos' [-Wunused-variable]
39 | int pos[0];
| ^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
340 KB |
Output is correct |
2 |
Correct |
2 ms |
340 KB |
Output is correct |
3 |
Correct |
3 ms |
340 KB |
Output is correct |
4 |
Correct |
3 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
39 ms |
664 KB |
Output is correct |
2 |
Correct |
52 ms |
644 KB |
Output is correct |
3 |
Correct |
27 ms |
468 KB |
Output is correct |
4 |
Correct |
44 ms |
596 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
66 ms |
912 KB |
Output is correct |
2 |
Correct |
102 ms |
896 KB |
Output is correct |
3 |
Correct |
93 ms |
912 KB |
Output is correct |
4 |
Correct |
50 ms |
896 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
66 ms |
924 KB |
Output is correct |
2 |
Correct |
104 ms |
888 KB |
Output is correct |
3 |
Correct |
96 ms |
932 KB |
Output is correct |
4 |
Correct |
48 ms |
888 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
93 ms |
916 KB |
Output is correct |
2 |
Correct |
102 ms |
908 KB |
Output is correct |
3 |
Correct |
99 ms |
900 KB |
Output is correct |
4 |
Correct |
45 ms |
912 KB |
Output is correct |
5 |
Correct |
69 ms |
940 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1080 ms |
9108 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1039 ms |
9528 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1082 ms |
10020 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1089 ms |
10684 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1090 ms |
10676 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1092 ms |
48112 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1092 ms |
48072 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1091 ms |
68440 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1096 ms |
68380 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1101 ms |
71520 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1101 ms |
71404 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1097 ms |
74712 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1097 ms |
58228 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1094 ms |
64612 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1100 ms |
64608 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |