Submission #1032464

#TimeUsernameProblemLanguageResultExecution timeMemory
1032464FatemehSalimiBalloons (CEOI11_bal)C++17
100 / 100
124 ms10580 KiB
//in the neme of god #include <bits/stdc++.h> using namespace std; stack <int> st; const int MAX_N = 2e5 + 10; double n, x[MAX_N], r[MAX_N], ans[MAX_N]; int main(){ ios_base::sync_with_stdio(0), cin.tie(0); cin >> n; for (int i = 0; i < n; i++) { cin >> x[i] >> r[i]; ans[i] = r[i]; while (st.size()) { double tmp = (x[i] - x[st.top()]) * (x[i] - x[st.top()]) / (4. * ans[st.top()]); ans[i] = min(ans[i], tmp); if (ans[st.top()] < ans[i]) st.pop(); else break; } st.push(i); } for (int i = 0; i < n; i++) cout << fixed << setprecision(3) << ans[i] << '\n'; }
#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...