# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
884586 |
2023-12-07T17:38:21 Z |
bedupako |
Mobile (BOI12_mobile) |
C++17 |
|
1000 ms |
48420 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)){
if(abs(R-ans) <= E){
break;
}
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 |
344 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 |
17 ms |
752 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
15 ms |
764 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
230 ms |
5196 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
302 ms |
4996 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
284 ms |
5512 KB |
Output is correct |
2 |
Correct |
341 ms |
5116 KB |
Output is correct |
3 |
Correct |
403 ms |
5328 KB |
Output is correct |
4 |
Incorrect |
424 ms |
5868 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
302 ms |
5700 KB |
Output is correct |
2 |
Correct |
400 ms |
5688 KB |
Output is correct |
3 |
Correct |
519 ms |
5696 KB |
Output is correct |
4 |
Incorrect |
733 ms |
5792 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
477 ms |
5968 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1004 ms |
24544 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1010 ms |
24888 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1046 ms |
36004 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1102 ms |
36148 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1049 ms |
40716 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1016 ms |
40688 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1037 ms |
43076 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1096 ms |
42488 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1062 ms |
48420 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1031 ms |
48192 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |