제출 #531411

#제출 시각아이디문제언어결과실행 시간메모리
531411CantfindmeBalloons (CEOI11_bal)C++17
100 / 100
247 ms12304 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define f first #define s second #define FAST ios_base::sync_with_stdio(0); cin.tie(0); #define all(x) x.begin(),x.end() typedef long double ld; typedef pair<ld,ld> pi; const int maxn = 200010; const int INF = LLONG_MAX/2; const int mod = 1e9+7; int n; ld x[maxn], r[maxn]; int32_t main() { FAST // #ifndef ONLINE_JUDGE // ifstream cin("input.txt"); // #endif cin >> n; for (int i =1;i<=n;i++) cin >> x[i] >> r[i]; stack <pi> s; for (int i =1;i<=n;i++) { while (!s.empty()) { auto [xp, rp] = s.top(); r[i] = min(r[i], (x[i] - xp) * (x[i] - xp) / (4 * rp)); if (r[i] >= rp) s.pop(); else break; } s.push(pi(x[i], r[i])); } for (int i =1;i<=n;i++) cout << fixed << setprecision(6) << 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...