Submission #1063641

#TimeUsernameProblemLanguageResultExecution timeMemory
1063641davieduBalloons (CEOI11_bal)C++17
10 / 100
108 ms14676 KiB
#include <bits/stdc++.h> using namespace std; #define fastio ios_base::sync_with_stdio(0); cin.tie(0) #define all(a) a.begin(), a.end() #define rall(a) a.rbegin(), a.rend() #define ll long long #define ld long double struct P{ ll x, y; }; void dbg_out() { cerr << endl; } template <typename H, typename... T> void dbg_out(H h, T... t) { cerr << ' ' << h; dbg_out(t...); } #define dbg(...) { cerr << #__VA_ARGS__ << ':'; dbg_out(__VA_ARGS__); } const ld prec = 0.0001; ld max_r(ll a, ll b, ld R){ return (a-b)*(a-b) / (4*R); } signed main(){ fastio; int n; cin >> n; vector<pair<int, ld>> arr (n); for (int i=0; i<n; i++){ cin >> arr[i].first >> arr[i].second; } vector<ld> ans (n); stack<int> can_touch; for (int i=0; i<n; i++){ auto [x, r] = arr[i]; ld best=r; while (!can_touch.empty()){ int X = arr[can_touch.top()].first; ld R = ans[can_touch.top()]; // touches if (best >= max_r(x, X, R)){ best = max_r(x, X, R); if (best >= R) can_touch.pop(); else break; } else break; } ans[i] = best; can_touch.push(i); } cout << fixed << setprecision(3); for (int i=0; i<n; i++) cout << ans[i] << ' '; cout << '\n'; }
#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...