Submission #634831

#TimeUsernameProblemLanguageResultExecution timeMemory
634831SharpEdgedBalloons (CEOI11_bal)C++17
30 / 100
341 ms5196 KiB
/* Online C++ Compiler and Editor */ #include <bits/stdc++.h> #define f first #define s second using namespace std; int main() { int n; cin >> n; vector<double> x(n); vector<double> r(n); stack<pair<double, double>> mono; auto eval = [&](pair<double, double> prev, double x){ return (prev.f - x) * (prev.f - x) / (4 * prev.s); }; for (int i = 0; i < n; i++){ cin >> x[i] >> r[i]; while (!mono.empty()){ double val = eval(mono.top(), x[i]); r[i] = min(r[i], val); if (mono.top().s <= val) { mono.pop(); } else { break; } } mono.push({x[i], r[i]}); } cout << fixed << setprecision(4) << '\n'; for (int i = 0; i < n; i++) cout << 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...