제출 #906654

#제출 시각아이디문제언어결과실행 시간메모리
906654KhanhMaBalloons (CEOI11_bal)C++14
0 / 100
163 ms4948 KiB
#include <bits/stdc++.h> #define forr(_a,_b,_c) for(_a = _b; _a <= _c; ++_a) #define ford(_a,_b,_c) for(_a = (_b) + 1; _a --> _c;) #define forf(_a,_b,_c) for(_a = _b; _a < _c; ++_a) #define ll long long #define ull unsigned long long #define pb push_back using namespace std; const int nmax = 2e5 + 5; const ll mod = 1e9 + 7; int i; struct balloons{ double x, r; }; double radius(balloons left, balloons right){ return (right.x - left.x)*(right.x - left.x)/(4*left.r); } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); //freopen("main.inp", "r", stdin); //freopen("main.out", "w", stdout); int n; cin >> n; stack<balloons> s; forr(i,1,n){ balloons a; cin >> a.x >> a.r; while(!s.empty() && s.top().r <= a.r) s.pop(); if(s.empty()){ cout << fixed << setprecision(3) << a.r << "\n"; s.push(a); continue; } double current = min(radius(s.top(), a), a.r); cout << fixed << setprecision(3) << current << "\n"; s.push(a); } 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...