Submission #772106

#TimeUsernameProblemLanguageResultExecution timeMemory
772106NK_Balloons (CEOI11_bal)C++17
100 / 100
148 ms3428 KiB
// Success consists of going from failure to failure without loss of enthusiasm #include <bits/stdc++.h> using namespace std; #define nl '\n' using ld = long double; const ld eps = 1e-9; int main() { cin.tie(0)->sync_with_stdio(0); cout << fixed << setprecision(10); int N; cin >> N; vector<pair<int, ld>> A; for(int i = 0; i < N; i++) { int x, r; cin >> x >> r; ld ans = r; while(size(A)) { ld D = ld(x - A.back().first) * ld(x - A.back().first); ld R = min(ld(r), D / (4 * A.back().second)); if ((ans - R) > eps) ans = R; // cout << ans - R << " - " << x << endl; if (ans+eps > A.back().second) A.pop_back(); else break; } cout << ans << nl; A.push_back({x, ans}); } return 0; }
#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...