# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
884585 |
2023-12-07T17:36:30 Z |
bedupako |
Mobile (BOI12_mobile) |
C++17 |
|
1000 ms |
48704 KB |
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(),x.end()
typedef long long ll;
const double E = 1e-9;
bool good(vector<pair<double,double>>& x, double l){
int n = x.size();
sort(all(x));
stack<pair<double,double>> s;
for(int i = 0; i < n; i++){
if(s.empty()){
s.push(x[i]);
}else if(s.top().second >= x[i].first){
s.top().second = max(s.top().second,x[i].second);
}else{
s.push(x[i]);
}
}
if((int)s.size() == 1){
if(abs(s.top().first) <= E and abs(s.top().second-l) <= E){
return true;
}
}
return false;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n,l;
cin >> n >> l;
vector<double> x(n),y(n);
for(int i = 0; i < n; i++){
cin >> x[i] >> y[i];
}
double low = 0, high = 1e+10;
double ans = 0l;
int cnt = 0;
while(high - low >= E and cnt <= 100){
cnt++;
//cout << "Iteration " << cnt << '\n';
double R = (low + high)/2;
// cout << "Radius " << R << '\n';
vector<pair<double,double>> ranges;
for(int i = 0; i < n; i++){
if(R < y[i]){
continue;
}else{
double val = sqrt(R*R - y[i]*y[i]);
ranges.emplace_back(max(0/1.0,(double)x[i]-val),
min((double)l,(double)x[i]+val));
}
}
if(good(ranges,l)){
ans = R;
high = R - E;
}else{
low = R + E;
}
}
cout << fixed << setprecision(6) << ans << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 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 |
6 ms |
604 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
15 ms |
752 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
16 ms |
756 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
12 ms |
756 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
238 ms |
4924 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
300 ms |
5048 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
279 ms |
5308 KB |
Output is correct |
2 |
Correct |
319 ms |
5392 KB |
Output is correct |
3 |
Correct |
405 ms |
5904 KB |
Output is correct |
4 |
Incorrect |
729 ms |
5812 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
494 ms |
5784 KB |
Output is correct |
2 |
Correct |
387 ms |
5680 KB |
Output is correct |
3 |
Correct |
524 ms |
5660 KB |
Output is correct |
4 |
Incorrect |
718 ms |
5704 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
483 ms |
6116 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1053 ms |
24356 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1055 ms |
24328 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1047 ms |
37296 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1037 ms |
36408 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1054 ms |
40900 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1064 ms |
39508 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1018 ms |
43972 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1014 ms |
45840 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1052 ms |
48704 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1037 ms |
48316 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |