Submission #649952

#TimeUsernameProblemLanguageResultExecution timeMemory
649952ymmBalloons (CEOI11_bal)C++17
70 / 100
2090 ms4380 KiB
#include <bits/stdc++.h> #define Loop(x,l,r) for (ll x = (l); x < (ll)(r); ++x) #define LoopR(x,l,r) for (ll x = (r)-1; x >= (ll)(l); --x) typedef long long ll; typedef std::pair<int, int> pii; typedef std::pair<ll , ll > pll; using namespace std; typedef pair<double, double> pdd; pdd in() { ll x, y; cin >> x >> y; return {x, y}; } const int N = 200'010; const int S = 2048; double a[N], b[N]; double x[N], r[N]; int len = 0; void insert(pdd f) { a[len] = f.first; b[len] = f.second; ++len; } __attribute__((optimize("Ofast,unroll-loops"),target("avx2,fma"))) double get(double x, int l, int r) { #define MIN(x, y) ((x)>(y)?(y):(x)) double ans = 1e30; Loop (i,l,r) { double tmp = a[i]*x + b[i]; ans = MIN(ans, tmp); } return ans; #undef MIN } int main() { cin.tie(0) -> sync_with_stdio(false); cout << fixed << setprecision(3); int n; cin >> n; Loop (i,0,n) { auto [x, r] = in(); r = sqrt(r); ::x[i] = x; ::r[i] = r; } for (int s = 0; s < n; s += S) { int f = min(s+S, n); Loop (i,s,f) { r[i] = min(r[i], get(x[i], s, i)); cout << r[i]*r[i] << '\n'; insert({0.5/r[i], -x[i]*0.5/r[i]}); } Loop (i,f,n) r[i] = min(r[i], get(x[i], s, f)); } }
#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...