Submission #632541

#TimeUsernameProblemLanguageResultExecution timeMemory
632541AanjaneyBalloons (CEOI11_bal)C++17
100 / 100
207 ms5436 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(double xi, double xj, double r) { double rad = (xi - xj) * (xi - xj); rad /= double(4 * r); return rad; } void solve(ll tcase) { ll n; cin >> n; stack<pair<double, double>> st; rep(i, 0, n) { double x, r; cin >> x >> r; double ans = r; while (!st.empty()) { auto p = st.top(); ans = min(ans, radius(p.f, x, p.s)); if (ans >= p.s) st.pop(); else break; } cout << fixed << setprecision(3) << ans << "\n"; st.push({x, ans}); } } 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...