Submission #1022468

#TimeUsernameProblemLanguageResultExecution timeMemory
1022468lucaskojimaBalloons (CEOI11_bal)C++17
100 / 100
139 ms5520 KiB
#include "bits/stdc++.h" #define ff first #define ss second #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define sz(x) (int)(x).size() using namespace std; using ll = long long; using pii = pair<int, int>; const char nl = '\n'; const ll LINF = 0x3f3f3f3f3f3f3f3f; const int INF = 0x3f3f3f3f; int main(){ ios::sync_with_stdio(0), cin.tie(0); int n; cin >> n; stack<pair<double, double>>st; for(int i=0; i<n; i++){ double x, r; cin >> x >> r; while(!st.empty()){ auto [x1, r1]=st.top(); r=min(r, (x-x1)*(x-x1)/(4*r1)); if(r>=r1) st.pop(); else break; } st.push({x, r}); cout << fixed << setprecision(3) << r << nl; } 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...