#include <bits/stdc++.h>
#ifdef DEBUG
#include "debug.hpp"
#endif
using namespace std;
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define rep(i, N) for (int i = 0; i < (N); ++i)
#define rrep(i, N) for (int i = (N)-1; i >= 0; --i)
#define rep1(i, N) for (int i = 1; i <= (N); ++i)
#define rep2(i, s, e) for (int i = (s); i <= (e); ++i)
#ifdef DEBUG
#define debug(x...) \
do { \
++dbg::depth; \
string dbg_vals = dbg::to_string(x); \
--dbg::depth; \
dbg::fprint(__func__, __LINE__, #x, dbg_vals); \
} while (false)
#else
#define debug(...) 42
#endif
template<typename T> inline T& ckmin(T& a, T b) { return a = a > b ? b : a; }
template<typename T> inline T& ckmax(T& a, T b) { return a = a < b ? b : a; }
#define double long double
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<int> x(n);
vector<double> r(n);
deque<int> s;
auto f = [&](int i, int X) -> double {
return (double)(X - x[i]) * (X - x[i]) / (4 * r[i]);
};
rep(i, n) {
cin >> x[i] >> r[i];
while (!s.empty()) {
ckmin(r[i], f(s.front(), x[i]));
if (r[s.front()] > r[i])
break;
else
s.pop_front();
}
s.push_front(i);
cout << fixed << setprecision(3) << r[i] << '\n';
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
10 numbers |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
2 numbers |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
332 KB |
505 numbers |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
332 KB |
2000 numbers |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
20 ms |
860 KB |
20000 numbers |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
49 ms |
1796 KB |
50000 numbers |
2 |
Correct |
47 ms |
2500 KB |
49912 numbers |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
96 ms |
3136 KB |
100000 numbers |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
112 ms |
3524 KB |
115362 numbers |
2 |
Correct |
110 ms |
5724 KB |
119971 numbers |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
145 ms |
4652 KB |
154271 numbers |
2 |
Correct |
183 ms |
9284 KB |
200000 numbers |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
183 ms |
5700 KB |
200000 numbers |
2 |
Correct |
178 ms |
9404 KB |
199945 numbers |