#include <iostream>
#include <iomanip>
using namespace std;
#include <math.h>
#include <vector>
vector <pair<int,long double>> v;
int main()
{
int n;
cin >> n;
for (int i = 0; i < n; i++){
long double r;
int x;
cin >> x;
cin >> r;
long double fis;
int j = v.size()-1;
long double m = r;
int ind = 0;
bool f = 0;
while (j >= 0){
long double o = x - v[j].first;
fis = o * o / (4 * v[j].second);
if (fis < r){
if (fis < m){
m = fis;
ind = v[j].first;
f = 1;
}
}
j--;
}
if (f){
int p = v.size()-1;
while (v.size() && v[p].first > ind){
v.pop_back();
p--;
}
}
if (v.empty()){
//cout << fixed << setprecision(3) << r << endl;
printf("%.3Lf\n",r);
v.push_back(make_pair(x,r));
}
else{
//cout << fixed << setprecision(3) << m << endl;
printf("%.3Lf\n",m);
v.push_back(make_pair(x,m));
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
384 KB |
505 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
512 KB |
2000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1062 ms |
1548 KB |
20000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2089 ms |
1672 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2037 ms |
1812 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2085 ms |
1780 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2082 ms |
1808 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2089 ms |
1904 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |