Submission #956907

#TimeUsernameProblemLanguageResultExecution timeMemory
956907dzzzBalloons (CEOI11_bal)C++17
100 / 100
157 ms14420 KiB
#include <bits/stdc++.h> #define int long long using namespace std; const int maxn = 2e5 + 10; struct ball{ long double x, r; }; int n; ball a[maxn]; long double ra[maxn]; signed main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cin >> n; for(int i = 1; i <= n; ++i) { cin >> a[i].x >> a[i].r; ra[i] = a[i].r; } deque <ball> d; for(int i = 1; i <= n; ++i) { while(!d.empty()) { ball tmp = d.back(); ra[i] = min(ra[i], (a[i].x - tmp.x)*(a[i].x-tmp.x) / (4.0*tmp.r)); if(ra[i] >= tmp.r) { d.pop_back(); } else break; } d.push_back({a[i].x, ra[i]}); } for(int i = 1; i <= n; ++i) { cout << fixed << setprecision(3)<< ra[i] << '\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...