Submission #720597

#TimeUsernameProblemLanguageResultExecution timeMemory
720597mariowongBalloons (CEOI11_bal)C++14
100 / 100
528 ms5500 KiB
#include <bits/stdc++.h> using namespace std; int ptr; long double sqr(long double a1){ return a1*a1; } struct ballon{ long double xx,rr; }a[200005]; int main(){ ios::sync_with_stdio(false); int n; cin >> n; for (int i=1;i<=n;i++){ long double x,r; cin >> x >> r; if (i == 1){ cout << setprecision(3) << fixed << r << "\n"; a[++ptr]={x,r}; } else { long double ans=r; while (ptr > 0){ ans=min(ans,sqr(x-a[ptr].xx)/4.0/a[ptr].rr); if (ans >= a[ptr].rr) ptr--; else break; } cout << setprecision(3) << fixed << ans << "\n"; a[++ptr]={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...