Submission #1299786

#TimeUsernameProblemLanguageResultExecution timeMemory
1299786polishprogrammerBalloons (CEOI11_bal)C++20
30 / 100
272 ms4412 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define lld long double #define fi first #define se second #define pb push_back lld promien(pair<lld, lld> okr, pair<lld, lld> nowy) { lld xs = okr.fi, rs = okr.se, x = nowy.fi, r = nowy.se, pocz = 0, kon = r, sr; return (x-xs)*(x-xs)/(4*rs); } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); lld n, r, x; cin >> n; vector<pair<lld, lld>> okr; for (lld i = 0; i < n; i++) { cin >> x >> r; lld wyn = r; while (!okr.empty() and promien(okr.back(), {x, r}) >= okr.back().se) { wyn = min(wyn, promien(okr.back(), {x, r})); okr.pop_back(); } if (!okr.empty()) wyn = min(wyn, promien(okr.back(), {x, r})); cout << fixed << setprecision(3) << wyn << endl; okr.pb({x, wyn}); } }
#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...