Submission #1077194

#TimeUsernameProblemLanguageResultExecution timeMemory
1077194serpent_121Balloons (CEOI11_bal)C++17
100 / 100
458 ms8788 KiB
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <map> #include <unordered_map> #include <set> #include <queue> #include <deque> #include <numeric> #include <cmath> #include <cstring> #include <climits> #include <stack> #include <bitset> #include <iomanip> typedef long long ll; using namespace std; // https://oj.uz/problem/view/CEOI11_bal const int PRECISION = 3; int main() { ll n; cin >> n; stack<pair<double,long double>> s; for (int i = 0; i<n; i++) { double x,r; cin >> x >> r; long double constraint = r; while (!s.empty()) { long double c = (x-s.top().first)*(x-s.top().first)/(long double)(4*s.top().second); constraint = min(constraint,c); if (constraint > s.top().second) s.pop(); // we are sure that we can inflate to at least s.top().second else break; // now we are sure that a stronger constraint cannot be delivered } s.push({x,constraint}); cout << fixed << setprecision(PRECISION); cout << constraint << '\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...