Submission #1077180

#TimeUsernameProblemLanguageResultExecution timeMemory
1077180serpent_121Balloons (CEOI11_bal)C++17
0 / 100
396 ms7504 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> typedef long long ll; using namespace std; // https://oj.uz/problem/view/CEOI11_bal int main() { ll n; cin >> n; long double inflated[n]; // final inflated radii stack<pair<ll,ll>> s; for (int i = 0; i<n; i++) { ll x,r; cin >> x >> r; long double constraint = r; while (!s.empty()) { long double c = (x-s.top().first)*(x-s.top().first)/(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 } inflated[i] = constraint; s.push({x,constraint}); cout << inflated[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...