이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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";
a.r = current;
s.push(a);
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |