Submission #651563

#TimeUsernameProblemLanguageResultExecution timeMemory
651563Melika0ghBalloons (CEOI11_bal)C++17
100 / 100
343 ms8524 KiB
#include<bits/stdc++.h> using namespace std; const int maxn = 2e5+10; double x[maxn], r[maxn]; vector<int> st; int n; void FindR(int ind) { int i = st.back(); double tmpr = (x[ind] - x[i]) / (double(4) * r[i]); tmpr *= (x[ind] - x[i]); //cout << ind << " , " << i << " , " << tmpr << endl; r[ind] = min(r[ind], tmpr); } int main() { cin >> n; for(int i = 0; i < n; i++) { cin >> x[i] >> r[i]; } for(int i = 0; i < n; i++) { while(!st.empty()) { FindR(i); if(r[i] >= r[st.back()]) { st.pop_back(); } else break; } st.push_back(i); } for(int i = 0; i < n; i++) { cout.precision(3); cout << fixed << r[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...