Submission #1026821

#TimeUsernameProblemLanguageResultExecution timeMemory
1026821JohnnyVenturasBalloons (CEOI11_bal)C++17
100 / 100
156 ms9300 KiB
#include <iostream> #include <stack> using namespace std; int coordinates[200000]; long double radius[200000]; long double compute_formula(int coordinate1, int coordinate2, long double r) { long double l = (coordinate2 - coordinate1) / 2.; return l * l / r; } int main() { int n; cin >> n; for(int i = 0; i < n; ++i) { cin >> coordinates[i]; cin >> radius[i]; } stack<int> st; for(int i = 0; i < n; ++i) { long double max_rad = radius[i]; while(!st.empty()) { int j = st.top(); int coordinate_j = coordinates[j]; long double radius_j = radius[j]; max_rad = min(max_rad, compute_formula(coordinate_j, coordinates[i] ,radius_j)); if(max_rad > radius[j] - 1e-10) st.pop(); else { break; } } if(max_rad < radius[i]) { radius[i] = max_rad; } printf("%.3Lf\n", radius[i]); st.emplace(i); } }
#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...