Submission #134410

#TimeUsernameProblemLanguageResultExecution timeMemory
134410MilkiBalloons (CEOI11_bal)C++14
100 / 100
281 ms11844 KiB
#include<bits/stdc++.h> using namespace std; #define FOR(i, a, b) for(int i = a; i < b; ++i) #define REP(i, n) FOR(i, 0, n) #define _ << " " << #define sz(x) ((int) x.size()) #define pb(x) push_back(x) #define TRACE(x) cerr << #x << " = " << x << endl typedef long long ll; typedef long double ld; typedef pair<ld, ld> point; const int MAXN = 2e5 + 5; const ld eps = 1e-12; int n; ld x[MAXN], r[MAXN]; stack <point> stek; int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cin >> n; REP(i, n){ cin >> x[i] >> r[i]; ld radijus = r[i]; while(sz(stek)){ ld xx = stek.top().first - x[i]; xx *= xx; radijus = min(radijus, ( xx ) / ((ld)4 * stek.top().second)); if(radijus > stek.top().second - eps) stek.pop(); else{ cout << setprecision(3) << fixed << radijus << "\n"; stek.push(point(x[i], radijus)); break; } } if(!sz(stek)){ cout << setprecision(3) << fixed << radijus << "\n"; stek.push(point(x[i], radijus)); } } }
#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...