Submission #632534

#TimeUsernameProblemLanguageResultExecution timeMemory
632534AanjaneyBalloons (CEOI11_bal)C++17
0 / 100
139 ms4772 KiB
#include <bits/stdc++.h> #define ll long long #define ull unsigned long long #define MOD 1000000007 #define MODA 998244353 #define pb push_back #define sortv(v) sort(v.begin(), v.end()) #define sorta(A, N) sort(A, A + N) #define debug(x) cerr << #x << " is " << x; #define rep(i, a, N) for (ll i = a; i < N; i++) #define f first #define s second #define uniq(v) \ { \ sort(v.begin(), v.end()); \ v.erase(unique(v.begin(), v.end()), v.end()); \ } #define speed \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); using namespace std; double radius(ll xi, ll xj, ll r) { double rad = (xi - xj) * (xi - xj); rad /= double(4 * r); return rad; } void solve(ll tcase) { ll n; ll INF = 1e9; cin >> n; stack<pair<ll, ll>> st; rep(i, 0, n) { ll x, r; cin >> x >> r; while (!st.empty() && radius(st.top().f, INF, st.top().s) >= radius(x, INF, r)) st.pop(); if (!st.empty()) cout << fixed << setprecision(3) << min(double(r), radius(st.top().f, x, st.top().s)) << "\n"; else cout << fixed << setprecision(3) << double(r) << "\n"; st.push({x, r}); } } int main() { speed; ll t = 1; rep(i, 1, t + 1) solve(i); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...