Submission #1178295

#TimeUsernameProblemLanguageResultExecution timeMemory
1178295qrnBalloons (CEOI11_bal)C++20
100 / 100
119 ms6820 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; #define SPEED \ ios_base::sync_with_stdio(0); \ cin.tie(NULL); \ cout.tie(NULL); #define pb push_back #define ins insert #define fi first #define se second #define endl "\n" #define ALL(x) x.begin(), x.end() #define sz(x) x.size() #define intt long long const intt mod = 1e9 + 7; const intt base = 31; const intt inf = 1e9; const intt mxN = 2e5 + 5; const intt L = 21; void solve() { intt N; cin >> N; vector<pair<double,double>> C; for(intt i = 0; i < N; i++) { double X, R; cin >> X >> R; C.pb({X, R}); } double maxR = 0, maxRa; intt maxRi = 0; vector<double> ans(N); ans[0] = C[0].se; maxR = C[0].fi; maxRa = C[0].se; priority_queue<pair<double,double>, vector<pair<double,double>>>pq; pq.push({C[0].fi, C[0].se}); for(intt i = 1; i < N; i++) { double r1 = C[i].se; while(not pq.empty()) { pair<double,double> cur = pq.top(); double val = (cur.fi - C[i].fi) * (cur.fi - C[i].fi) / (4.0 * cur.se); // cout << i << ": " << val << endl;; r1 = min(r1, val); if(cur.se <= r1) { pq.pop(); } else { break; } } // r1 = min(r1, C[i].se); pq.push({C[i].fi, r1}); ans[i] = r1; } for(intt i = 0; i < N; i++) { cout.precision(3); cout << fixed << ans[i] << endl; } } signed main() { SPEED; intt tst = 1; // cin >> tst; while (tst--) { solve(); } }
#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...