제출 #634837

#제출 시각아이디문제언어결과실행 시간메모리
634837SharpEdgedBalloons (CEOI11_bal)C++17
30 / 100
345 ms8232 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) -> ld { 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...