Submission #755208

#TimeUsernameProblemLanguageResultExecution timeMemory
755208faricaBalloons (CEOI11_bal)C++14
0 / 100
567 ms5920 KiB
#include <bits/stdc++.h> #define ll long long using namespace std; typedef vector<int> vi; typedef pair<int,int> pi; const int INF = 1e9; const int MX = 5e5 + 23; const int MOD = 1e9+7; const int MAX_N = 1e6; const int MAX_N2 = 1e5; const int TWO_MOD_INV = 500000004; const int M = 998244353; bool intersect(int x1, int r1, int x2, int r2) { if(sqrt((x1-x2)*(x1-x2)+(r1-r2)*(r1-r2))<=(r1+r2)) return 1; return 0; } void solve() { int n; cin >> n; int x[n]; long double r[n]; stack<int>s; for(int i=0; i<n; ++i) { cin >> x[i] >> r[i]; if(!i) { s.push(i); cout << fixed << setprecision(3) << r[i] << endl; continue; } while(!s.empty()) { int cur=s.top(); if(intersect(x[i], r[i], x[cur], r[cur])) { r[i]=((x[i]-x[cur])*(x[i]-x[cur]))/(4*r[cur]); } else break; s.pop(); } cout << fixed << setprecision(3) << r[i] << endl; s.push(i); } } signed main() { //freopen("mootube.in","r",stdin); //freopen("mootube.out","w",stdout); int t=1; while(t--) 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...