# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1202845 | goulthen | Balloons (CEOI11_bal) | C++20 | 126 ms | 1952 KiB |
//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template <class T>
using Tree =
tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define int long long
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define fi first
#define se second
#define rep(i, a, b) for (int i = a; i <= b; ++i)
#define per(i, b, a) for (int i = b; i >= a; --i)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define lsb(x) (x)&(-x)
void setIO(string name = "") {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);cout.tie(nullptr);
if (!name.empty()) {
freopen((name + ".in").c_str(), "r", stdin);
freopen((name + ".out").c_str(), "w", stdout);
}
}
ll fexp(ll a, ll b, ll m) {
if (b == 0) return 1LL;
ll p = a;
ll ans = 1;
while (b > 0) {
if (b % 2 != 0) ans = (ans*p)%m;
p = (p*p)%m;
b >>= 1;
}
return ans;
}
const int MAXN = 310;
const long long INF = 1e18+5;
const int MOD = 1e9+7;
#define dl long double
void solve() {
int n;cin >> n;
stack<pair<dl,dl>> st;
rep(i,1,n) {
dl x,r,nr;cin >> x >> r;
nr =r ;
while (!st.empty()) {
pair<dl,dl> t = st.top();
nr = min(r,(t.fi-x)*(t.fi-x)/(4*t.se));
if (nr <= t.se) break;
st.pop();
}
st.push({x,nr});
cout << fixed << setprecision(3) << nr << '\n';
}
}
int32_t main() {
setIO();
int tt = 1;
//cin >> tt;
while (tt-- > 0) solve();
}
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... |