Submission #945455

#TimeUsernameProblemLanguageResultExecution timeMemory
945455nolqfBalloons (CEOI11_bal)C++14
10 / 100
152 ms8408 KiB
#include <bits/stdc++.h> using namespace std; using ld = long double; const int DIM = 2e5 + 5; ld x[DIM], r[DIM]; inline ld get( int i, int j ) { return (x[i] - x[j]) * (x[i] - x[j]) / (4.0 * r[j]); } int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; ld aux; cin >> n; for ( int i = 1; i <= n; ++i ) { cin >> x[i] >> r[i]; } vector<int> stk; for ( int i = 1; i <= n; ++i ) { while ( stk.size() && r[i] >= (aux = get(i, stk.back())) ) { r[i] = aux; stk.pop_back(); } if ( stk.size() ) { r[i] = min(r[i], get(i, stk.back())); } stk.push_back(i); } cout << fixed << setprecision(3); for ( int i = 1; 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...