#include "bits/stdc++.h"
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const char nl = '\n';
const ll LINF = 0x3f3f3f3f3f3f3f3f;
const int INF = 0x3f3f3f3f;
int main(){
ios::sync_with_stdio(0), cin.tie(0);
int n; cin >> n;
stack<pair<double, double>>st;
for(int i=0; i<n; i++){
double x, r; cin >> x >> r;
while(!st.empty()){
auto [x1, r1]=st.top();
r=min(r, (x-x1)*(x-x1)/(4*r1));
if(r>=r1) st.pop();
else break;
}
st.push({x, r});
cout << fixed << setprecision(3) << r << nl;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
505 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
348 KB |
2000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
25 ms |
736 KB |
20000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
55 ms |
1576 KB |
50000 numbers |
2 |
Correct |
31 ms |
1628 KB |
49912 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
76 ms |
2896 KB |
100000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
80 ms |
3156 KB |
115362 numbers |
2 |
Correct |
86 ms |
3648 KB |
119971 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
106 ms |
4176 KB |
154271 numbers |
2 |
Correct |
126 ms |
5520 KB |
200000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
139 ms |
4580 KB |
200000 numbers |
2 |
Correct |
138 ms |
5520 KB |
199945 numbers |