Submission #570509

#TimeUsernameProblemLanguageResultExecution timeMemory
570509NeriWBalloons (CEOI11_bal)C++17
10 / 100
240 ms18380 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> vll; typedef pair<ll, ll> pll; typedef vector<pll> vpll; typedef vector<ll> vll; typedef long double ld; typedef vector<ld> vld; typedef pair<ld, ld> pld; typedef vector<pld> vpld; const ll inf = 1e18; ld nr(ld x1, ld x2, ld r1) { return ((x1-x2)*(x1-x2))/(4*r1); } int main() { //freopen("..\\io\\input.txt", "r", stdin); //freopen("..\\io\\output.txt", "w", stdout); ios_base::sync_with_stdio(false);cin.tie(NULL); int n; cin >> n; vpld v(n); vld ans(n); vpll a(n, {-1, n}); for(int i = 0; i < n; i++) { cin >> v[i].first >> v[i].second; } stack<pld> s; for(int i = 0; i < n; i++) { ld r = inf; while(!s.empty()) { ld ri = nr(s.top().first , v[i].first , ans[s.top().second]); if(ri < r && ri <= v[i].second) { r = ri; s.pop(); } else break; } ans[i] = min(v[i].second, r); s.push({v[i].first, i}); } cout << fixed << setprecision(3); for(auto a : ans) cout << a << "\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...