#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define str string
#define pb push_back
#define pf push_front
#define pob pop_back()
#define pof pop_front()
#define in insert
#define fi first
#define se second
#define size size()
#define begin begin()
#define end end()
#define back back()
#define front front()
#define rend rend()
#define rbegin rbegin()
#define ret return
#define ull unsigned long long
#define all(a) a.begin , a.end
#define gcd __gcd
#define lcm(a , b) (a * b) / gcd(a , b)
#define friopen freopen ("exercise.in", "r", stdin); freopen("exercise.out", "w", stdout);
using namespace std;
using namespace __gnu_pbds;
typedef tree<long long, null_type, less_equal<long long>, rb_tree_tag, tree_order_statistics_node_update> pbds;
const ll mod = 1e9 + 7 , mod2 = 998244353 , N = 5e5 , inf = 1e18;
const ld esp = 0.0000001 , Pi = 3.1415926535897932384626433832795;
ld dist(ld x1 , ld y1 , ld x2 , ld y2)
{
ret sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
void kol_a()
{
cout << fixed << setprecision(10);
ll n , i , j;
cin >> n;
ld x[n + 12] = {} , v[n + 12] = {};
for (i = 1 ; i <= n ; i ++)
{
ld l = 0 , r , m;
cin >> x[i] >> r;
r += esp;
while(l + esp < r)
{
m = (l + r) / 2;
for (j = 1 ; j < i ; j ++)
{
if (dist(x[i] , m , x[j] , v[j]) <= m + v[j])
{
// cout << dist(x[i] , m , x[j] , v[j]) << '\n';
r = m;
goto to;
}
}
l = m;
to:;
}
v[i] = l;
cout << l << '\n';
}
}
main()
{
// friopen
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ll _ = 1;
// cin >> _;
while(_ --) kol_a();
}
/*
*/
컴파일 시 표준 에러 (stderr) 메시지
bal.cpp:85:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
85 | main()
| ^~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |