Submission #1011149

#TimeUsernameProblemLanguageResultExecution timeMemory
1011149vjudge1Balloons (CEOI11_bal)C++17
100 / 100
128 ms7764 KiB
#include <bits/stdc++.h> using i64 = long long; int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int n; std::cin >> n; std::vector<int> x(n); std::vector<double> r(n); for (int i = 0; i < n; i++) { std::cin >> x[i] >> r[i]; } std::vector<std::tuple<int, double>> s; for (int i = 0; i < n; i++) { while (s.size()) { auto [x1, r1] = s.back(); r[i] = std::min(r[i], 1.0 * (x[i] - x1) * (x[i] - x1) / 4 / r1); if (r[i] >= r1) { s.pop_back(); } else { break; } } s.push_back({x[i], r[i]}); } for (int i = 0; i < n; i++) { std::cout << std::fixed << std::setprecision(3) << r[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...