# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
884587 |
2023-12-07T17:41:04 Z |
bedupako |
Mobile (BOI12_mobile) |
C++17 |
|
1000 ms |
49068 KB |
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(),x.end()
typedef long long ll;
const double E = 1e-3;
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 |
344 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 |
5 ms |
604 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
752 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
11 ms |
892 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
756 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
172 ms |
5128 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
194 ms |
5928 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
182 ms |
5308 KB |
Output is correct |
2 |
Correct |
225 ms |
5148 KB |
Output is correct |
3 |
Correct |
263 ms |
5208 KB |
Output is correct |
4 |
Incorrect |
316 ms |
5844 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
242 ms |
5704 KB |
Output is correct |
2 |
Correct |
274 ms |
5692 KB |
Output is correct |
3 |
Correct |
329 ms |
5704 KB |
Output is correct |
4 |
Incorrect |
321 ms |
5868 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
210 ms |
5716 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1036 ms |
24452 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1053 ms |
24340 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1087 ms |
36092 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1039 ms |
37364 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1050 ms |
40600 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1037 ms |
40660 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1069 ms |
42920 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1042 ms |
42808 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1043 ms |
49068 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1043 ms |
48400 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |