Submission #1026795

#TimeUsernameProblemLanguageResultExecution timeMemory
1026795JohnnyVenturasBalloons (CEOI11_bal)C++17
0 / 100
140 ms8780 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 = 10000000; while(!st.empty()) { int j = st.top(); int coordinate_j = coordinates[j], radius_j = radius[j]; max_rad = compute_formula(coordinate_j, coordinates[i] ,radius_j); if(max_rad < radius[i]) 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...