Submission #649534

#TimeUsernameProblemLanguageResultExecution timeMemory
649534parsadox2Balloons (CEOI11_bal)C++14
100 / 100
565 ms9304 KiB
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 10; int x[maxn] , n; long double r[maxn]; vector <int> st; void f(int ps) { int j = st.back(); long double tmp = 1.0 * (x[ps] - x[j]) / (1.0 * 4 * r[j]); tmp = 1.0 * tmp * (x[ps] - x[j]); r[ps] = min(r[ps] , tmp); } 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()) { f(i); if(r[i] >= r[st.back()]) st.pop_back(); else break; } st.push_back(i); } for(int i = 0 ; i < n ; i++) cout << setprecision(3) << fixed << r[i] << endl; 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...