제출 #1300817

#제출 시각아이디문제언어결과실행 시간메모리
1300817zowiBalloons (CEOI11_bal)C++20
100 / 100
524 ms4396 KiB
#include<bits/stdc++.h> using namespace std; vector<pair<double,double>> tab; const double eps = 0.00001; bool czy(double a,double b) { double x = tab.back().first-a; double y = tab.back().second-b; double z = tab.back().second+b; if(x*x+y*y >= z*z) { return 0; } return 1; } int main() { ios_base::sync_with_stdio(0); int n,a,b; cin >> n; vector<double> wyn; for(int i = 0;i < n;++i) { cin >> a >> b; double c = b; while(tab.size() > 0) { double l = 0.0,p = c,mid; for(int j = 0;j < 60;++j) { mid = (l+p)/2; if(czy(a,mid)) { p = mid; } else { l = mid; } } c = min(c,l); if(l < tab.back().second) break; tab.pop_back(); } if(tab.size() == 0) { wyn.push_back(c); tab.push_back({a,c}); } else { double l = 0.0,p = c,mid; for(int j = 0;j < 60;++j) { mid = (l+p)/2; if(czy(a,mid)) { p = mid; } else { l = mid; } } c = min(c,l); wyn.push_back(c); tab.push_back({a,c}); } } for(double i : wyn) { cout << fixed << setprecision(3); cout << i << endl; } }
#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...