#include <bits/stdc++.h> // clang-format off
#define princess_connect(file,extention) if(fopen(file "." extention, "r")) freopen(file "." extention, "r", stdin)
#define yabai_desune ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define __Pecorine__ signed main()
#define For(i, l, r) for (int i = l; i <= r; i++)
#define Fod(i, r, l) for (int i = r; i >= l; i--)
#define ll long double
#define pb push_back
#define sz(yuuki) (int)yuuki.size()
#define bit(x, i) (x >> i) & 1
#define endl "\n"
using namespace std;/* //
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠙⠻⠟⠛⠻⢿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠹⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣯⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡆⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣿
⣿⣿⣿⡟⠿⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⡀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣀⠀⢸⣿
⣿⡄⠀⠀⠀⠀⠀⠻⠿⣿⣿⣿⣿⣿⡷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣼⣿⣿⣿
⣿⣷⡀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠛⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿
⣿⣿⣿⣷⣶⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣿⣿⣿
⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠋⣉⣽
⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⣿⣿
⣿⣿⣿⣿⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢿⣿
*/ // clang-format on
const int inf = 2e9;
const int mxn = 2 * 1e5 + 7;
const int mod = 1e9 + 7;
long double base = 1e10;
int n;
vector<pair<ll, ll>> a(mxn);
vector<pair<ll, ll>> res;
ll calc(const pair<ll, ll> &x, const pair<ll, ll> &y) {
long long l = 0;
long long r = y.second;
while (l < r) {
long long m = ((r + l) >> 1) + 1;
long double a = abs(x.second - m) / base;
long double b = (y.first - x.first) / base;
long double c = sqrt(a * a + b * b);
if ((x.second + m) / base <= c) {
l = m;
} else {
r = m - 1;
}
}
return l;
}
__Pecorine__ {
yabai_desune;
princess_connect("yabai", "desune");
cin >> n;
For(i, 1, n) cin >> a[i].first >> a[i].second;
For(i, 1, n) {
a[i].first *= base;
a[i].second *= base;
}
sort(a.begin() + 1, a.begin() + 1 + n);
For(i, 1, n) {
while (sz(res) && res.back().first + res.back().second <= a[i].first - a[i].second) {
res.pop_back();
}
For(j, 0, sz(res) - 1) {
a[i].second = min(a[i].second, calc(res[j], a[i]));
}
res.pb(a[i]);
}
For(i, 1, n) {
cout << fixed << setprecision(3) << a[i].second / base << endl;
}
}
컴파일 시 표준 에러 (stderr) 메시지
bal.cpp: In function 'int main()':
bal.cpp:2:84: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
2 | #define princess_connect(file,extention) if(fopen(file "." extention, "r")) freopen(file "." extention, "r", stdin)
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bal.cpp:59:5: note: in expansion of macro 'princess_connect'
59 | princess_connect("yabai", "desune");
| ^~~~~~~~~~~~~~~~| # | 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... |