#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using d64 = long double;
i64 sq(int a) {
return 1LL * a * a;
}
d64 calc(int ax, int bx, d64 ar) {
return d64(sq(bx - ax)) / (4 * ar);
}
#define ONLINE_JUDGE
void solve() {
int n;
cin >> n;
vector <int> x(n +1);
vector <d64> r(n +1);
for(int i = 1; i <= n; i++) {
cin >> x[i] >> r[i];
}
cout.precision(9);
for(int i = 1; i <= n; i++) {
for(int j = i -1; j >= 1; j--) {
r[i] = min(r[i], calc(x[i], x[j], r[j]));
}
cout << r[i] << "\n";
}
return;
}
signed main() {
#ifndef ONLINE_JUDGE
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
#endif
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
int t = 1; //cin >> t;
for(int i = 1; i <= t; i++) {
solve();
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
504 KB |
2nd numbers differ - expected: '252735385.4379999936', found: '252735385.0000000000', error = '0.4379999936' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
505 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
344 KB |
2000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
951 ms |
1480 KB |
20000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2040 ms |
1900 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2053 ms |
2776 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2052 ms |
3180 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2027 ms |
3864 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2051 ms |
4768 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |