# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
872457 | sleepntsheep | Balloons (CEOI11_bal) | C++17 | 2064 ms | 4192 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <vector>
#include <algorithm>
#include <deque>
#include <set>
#include <utility>
#include <array>
using i64 = long long;
using u64 = unsigned long long;
using f64 = double;
using f80 = long double;
using namespace std;
#define ALL(x) x.begin(), x.end()
#define ShinLena cin.tie(nullptr)->sync_with_stdio(false);
#define N 200005
int n, x[N];
f80 r[N];
int main()
{
ShinLena;
cin >> n;
for (int i = 0; i < n; ++i) cin >> x[i] >> r[i];
deque<int> q;
q.push_back(0);
for (int st = 0, i = 1; i < n; ++i)
{
f80 l = 0, r = ::r[i], iter = 50;
for (; iter--;)
{
f80 m = (l+r)/2, ok = 1;
for (auto it = q.rbegin(); ok and it != q.rend(); ++it)
{
int j = *it;
f80 A = 1L * x[i] * x[i] + 1L * x[j] * x[j] - 2L * x[i] * x[j] - 4L * ::r[j] * m;
if (A < 0) ok = 0;
}
if (ok) l = m;
else r = m;
}
::r[i] = l;
while (q.size() && ::r[q.back()] <= ::r[i]) q.pop_back();
q.push_back(i);
}
cout << fixed << setprecision(3);
for (int i = 0; i < n; ++i)
cout << r[i] << '\n';
return 0;
}
Compilation message (stderr)
# | 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... |