/*
Khangnh's code
“You can either experience the pain of discipline or the pain of regret.
The choice is yours.”
*/
// - Only when necessary :d
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
#define fileopen(a, b) freopen(((string)a + ".inp").c_str(), "r", stdin); freopen(((string)b + ".out").c_str(), "w", stdout);
#define ll long long
#define ld long double
#define int long long
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
typedef pair<int, int> pii;
const ll mod = 1e9 + 7;
const ll inf = 1e9 + 7;
const double eps = 1e-9;
int n;
int x[200005];
ld r[200005];
stack<pair<int, ld>> st;
ld inflate(int x0, ld r0) {
while (!st.empty()) {
pii k = st.top();
r0 = min(r0, (ld)(k.fi - x0)*(k.fi - x0)/(4*k.se));
if (r0 >= k.se) st.pop();
else break;
}
st.push({x0, r0});
return r0;
}
void solve() {
cin >> n;
for (int i = 1; i <= n; ++i) cin >> x[i] >> r[i];
cout << fixed << setprecision(3);
for (int i = 1; i <= n; ++i) cout << inflate(x[i], r[i]) << "\n";
}
signed main() {
#ifdef LOCAL
fileopen("input", "output");
auto start = clock();
#endif
#ifndef LOCAL
// fileopen("LAH", "LAH");
#endif
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int t = 1;
// cin >> t;
while (t--) solve();
#ifdef LOCAL
auto end = clock();
cout << "\n\nExecution time : " << double(end - start)/CLOCKS_PER_SEC << "[s]";
#endif
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
8th numbers differ - expected: '8.7410000000', found: '9.0910000000', error = '0.3500000000' |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
332 KB |
2 numbers |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
13th numbers differ - expected: '2.3960000000', found: '2.4500000000', error = '0.0540000000' |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
332 KB |
3rd numbers differ - expected: '121.0000000000', found: '121.0020000000', error = '0.0020000000' |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
23 ms |
1176 KB |
44th numbers differ - expected: '165.0000000000', found: '165.0020000000', error = '0.0020000000' |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
56 ms |
2916 KB |
254th numbers differ - expected: '15129.9990000000', found: '15130.0010000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
113 ms |
5232 KB |
286th numbers differ - expected: '7633.9990000000', found: '7634.0010000000', error = '0.0020000000' |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
134 ms |
5980 KB |
511th numbers differ - expected: '4494.0050000000', found: '4494.0070000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
172 ms |
7824 KB |
165th numbers differ - expected: '1698.9980000000', found: '1699.0000000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
214 ms |
9364 KB |
249th numbers differ - expected: '2683.0090000000', found: '2683.0110000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |