Submission #755224

#TimeUsernameProblemLanguageResultExecution timeMemory
755224faricaBalloons (CEOI11_bal)C++14
20 / 100
599 ms7680 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(); r[i]=min(r[i],((x[i]-x[cur])*(x[i]-x[cur]))/(4*r[cur])); if(r[i]>=r[cur]) { s.pop(); continue; } else break; } 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...