#include <bits/stdc++.h>
using namespace std;
int main(){
int n; cin >> n;
//pos, rad
stack<pair<long double, long double>> stack;
for (int i = 0; i < n; i++){
long double loc, sz; cin >> loc >> sz;
while (!stack.empty()){
sz = min(sz, ((loc-stack.top().first)*(loc-stack.top().first))/(4*stack.top().second));
if (sz >= stack.top().second) stack.pop();
else break;
}
stack.push({loc, sz});
cout<<fixed<<setprecision(3)<<sz<<endl;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
204 KB |
505 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
204 KB |
2000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
74 ms |
420 KB |
20000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
198 ms |
952 KB |
50000 numbers |
2 |
Correct |
186 ms |
1556 KB |
49912 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
386 ms |
1384 KB |
100000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
434 ms |
1584 KB |
115362 numbers |
2 |
Correct |
449 ms |
3284 KB |
119971 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
601 ms |
1776 KB |
154271 numbers |
2 |
Correct |
761 ms |
5384 KB |
200000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
755 ms |
1976 KB |
200000 numbers |
2 |
Correct |
761 ms |
5396 KB |
199945 numbers |