Submission #948493

#TimeUsernameProblemLanguageResultExecution timeMemory
948493lssplyBalloons (CEOI11_bal)C++17
100 / 100
156 ms8692 KiB
#include <bits/stdc++.h> using namespace std; //#define cin fin //#define cout fout ifstream fin("conexidad.in"); ofstream fout("conexidad.out"); #define int unsigned long long #define pii pair<int,int> #define pb push_back #define vi vector<int> #define vp vector<pair<int,int>> const int maxNr=2e5, mod = 1e9+7, inf = 2e9; int n; struct cv{double x; double r;}a[maxNr+1]; double calc(cv x, cv y) { return (x.x-y.x)*(x.x-y.x)/(4*x.r); } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; for(int i=1;i<=n;i++) cin >> a[i].x >> a[i].r; stack<int>st; for(int i=1;i<=n;i++) { while(!st.empty()) { double r=min(calc(a[st.top()], a[i]), a[i].r); a[i].r=r; if(r>=a[st.top()].r) { st.pop(); } else break; } cout << fixed << setprecision(3) << a[i].r << '\n'; st.push(i); } 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...