Submission #634834

#TimeUsernameProblemLanguageResultExecution timeMemory
634834SharpEdgedBalloons (CEOI11_bal)C++17
30 / 100
382 ms8236 KiB
/* Online C++ Compiler and Editor */ #include <bits/stdc++.h> #define f first #define s second typedef long double ld; using namespace std; int main() { int n; cin >> n; vector<ld> x(n); vector<ld> r(n); stack<pair<ld, ld>> mono; auto eval = [&](pair<ld, ld> prev, ld 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()){ ld 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...