이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
//#define int int64_t
#define all(x) x.begin(), x.end()
#define all1(x) x.rbegin(), x.rend()
#define sz(x) (int)(x.size())
const int N = 1e5 + 5, mod = 1e9 + 7;
const int64_t N1=1e18;
const double eps=1e-11;
//#define double long double
void solve(){
int n;
cin>>n;
vector<pair<double,double>> z(n);
for (pair<double,double> &it:z){cin>>it.first>>it.second;}
stack<pair<double,double>> s;
for (int i=0;i<n;i++){
bool chk=1;
while(1){
if (s.empty()){
s.emplace(z[i].first,z[i].second);
break;
}
else{
double x=z[i].first,y=z[i].second,x1=s.top().first,y1=s.top().second;
double r=1.0*(1.0*(x1-x)*(x1-x))/(4.0*y1);
if (chk){chk=0,r=min(y,r);}
if (r>=y1){s.pop();}
else{
s.emplace(z[i].first,r);
break;
}
}
}
cout<<fixed<<setprecision(3)<<s.top().second<<"\n";
}
}
int32_t main(){
ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr);
int tq = 1;
//cin>>tq;
for (;tq;tq--){solve();}
}
# | 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... |