Submission #1123289

#TimeUsernameProblemLanguageResultExecution timeMemory
1123289heeyBalloons (CEOI11_bal)C++20
10 / 100
120 ms5004 KiB
#include<bits/stdc++.h> #define f first #define s second #define all(x) (x).begin(), (x).end() #define mod 1'000'000'007 #define inf 1'000'000'000'000'00 #define pb push_back #define vvi vector<vi> #define fst ios_base::sync_with_stdio(0);cin.tie(0); using namespace std; int x[200005], r[200005]; signed main(){ fst int n; cin >> n; for(int i = 0; i < n; i++){ cin >> x[i] >> r[i]; } vector<double> ans(n); int mx = 1; int px = 0; for(int i = 0; i < n-1; i++){ ans[i] = r[i]; if(i != 0){ ans[i] = min(ans[i], (double)(x[i] - px)*(x[i] - px)/(4*mx)); int d = x[i+1] - x[i]; if((double)d*d/(4*ans[i]) < (double)(x[i+1]-px)*(x[i+1]-px)/(4*mx)){ mx = ans[i]; px = x[i]; } } else{ px = x[i]; mx = ans[i]; } } ans[n-1] = min((double)r[n-1], (double)(x[n-1]-px)*(x[n-1]-px)/(4*mx)); cout << fixed << setprecision(3); for(int i = 0; i < n; i++) cout << ans[i] << '\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...