Submission #656996

#TimeUsernameProblemLanguageResultExecution timeMemory
656996NafeeszxBalloons (CEOI11_bal)C++14
0 / 100
112 ms12676 KiB
#pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> using namespace std; #define trav(a, x) for(auto& a : x) #define FOR(i, a, b) for (int i=(a); i<=(signed)(b); i++) #define ROF(i, a, b) for (int i=(a); i>=(signed)(b); i--) #define F0R(i, a) for (int i=0; i<(signed)(a); i++) #define vi vector<int> #define all(v) (v).begin(), (v).end() #define f first #define s second typedef long long ll; const int mod = 1e9 + 7, MOD = 998244353; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; vector<pair<double, double>> v(n); stack<pair<double, double>> rad; vector<double> res(n, 1e18); F0R(i, n) { cin >> v[i].first >> v[i].second; } F0R(i, n) { if(i == 0) { rad.push({v[i].first, v[i].second}); res[i] = v[i].second; continue; } double ans = 0; while(!rad.empty() && rad.top().second <= ans) { rad.pop(); ans = max(ans, ((rad.top().first - v[i].first)*(rad.top().first - v[i].first))/(4*rad.top().second)); } res[i] = min(ans, v[i].second); rad.push({v[i].first, res[i]}); } F0R(i, n) { cout << fixed << setprecision(3) << res[i] << "\n"; } 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...