Submission #693430

#TimeUsernameProblemLanguageResultExecution timeMemory
693430yuuCGBalloons (CEOI11_bal)C++17
100 / 100
187 ms7028 KiB
#include <bits/stdc++.h> #define FOR(i,a,b) for(int i=a;i<=b;i++) #define FORD(i,a,b) for(int i=a;i>=b;i--) #define TASK "mincut" #define ll long long #define MAXN 1000006 #define pii pair<long long,long long> #define pdd pair<double, double> #define ppi pair<ll,pii> #define ff first #define ss second #define pb push_back #define oo 1e18 using namespace std; const ll MOD=1e9+7; bool minimize(ll &a,ll b) { if (a>b) { a=b; return true; } return false; } bool maximize (ll &a,ll b) { if (a<b) { a=b; return true; } return false; } ll n; void nhap() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; } double calc(pdd x,double y) { return ((x.ff-y)*(x.ff-y))/(4*1.0*x.ss); } void solve() { vector<double> ans; ans.resize(n+5); stack<pdd> check; FOR(i,1,n) { double x,r; cin >> x >> r; double max_r=r; while (!check.empty()) { pdd last=check.top(); double last_r=calc(last,x); max_r=min(max_r,last_r); if (max_r>=last.ss) { check.pop(); continue; } else break; } check.push({x,max_r}); ans[i]=max_r; } FOR(i,1,n) cout << fixed << setprecision(3) << ans[i] << '\n'; } int main() { nhap(); solve(); 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...