Submission #714524

#TimeUsernameProblemLanguageResultExecution timeMemory
714524stevancvBalloons (CEOI11_bal)C++14
100 / 100
215 ms5508 KiB
#include <bits/stdc++.h> #define ll long long #define ld long double #define sp ' ' #define en '\n' #define smin(a, b) a = min(a, b) #define smax(a, b) a = max(a, b) using namespace std; const int N = 1e5 + 2; const int M = 1e6 + 2; const ll linf = 1e18; ld F(ld xi, ld xj, ld rj) { ld c = (xi - xj) * (xi - xj); c /= 4 * rj; return c; } int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; stack<pair<ld, ld>> s; for (int i = 0; i < n; i++) { ld x, y; cin >> x >> y; while (!s.empty()) { smin(y, F(x, s.top().first, s.top().second)); if (y >= s.top().second) s.pop(); else break; } cout << fixed << showpoint << setprecision(3) << y << en; s.push({x, y}); } 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...