#include <bits/stdc++.h>
#include "iomanip"
using namespace std;
const long double EPS = 1e-9;
int main()
{
typedef long double ld;
int n; cin>>n; stack<pair<ld, ld>>s;
for(int l=0;l<n;l++) {
ld x, r; cin>>x>>r;
while(!s.empty()) {
ld x1=s.top().first, r1=s.top().second;
r=min(r, (x-x1)*(x-x1)/(4.0*r1));
if(r>=r1) s.pop();
else break;
}
cout<<setprecision(3)<<fixed<<r<<'\n'; s.push({x, r});
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
204 KB |
505 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
320 KB |
2000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
75 ms |
348 KB |
20000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
192 ms |
1016 KB |
50000 numbers |
2 |
Correct |
204 ms |
1520 KB |
49912 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
394 ms |
1484 KB |
100000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
443 ms |
1632 KB |
115362 numbers |
2 |
Correct |
489 ms |
3320 KB |
119971 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
591 ms |
2020 KB |
154271 numbers |
2 |
Correct |
790 ms |
5476 KB |
200000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
761 ms |
1824 KB |
200000 numbers |
2 |
Correct |
776 ms |
5444 KB |
199945 numbers |