이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;
typedef pair<int, pair<int,int> > piii;
typedef pair<pair<ll,ll> ,pair<ll, ll> > plll;
typedef vector <ll> vi;
#define forw(i,a,b) for (ll i=a;i<=(b);i++)
#define forb(i,a,b) for (ll i=a;i>=(b);i--)
#define fastIO {ios::sync_with_stdio(false); cin.tie(0); }
#define fi first
#define se second
#define pu push
#define puf push_front
#define pb push_back
#define pof pop_front
#define pob pop_back
#define fr front
#define all(a) a.begin(),a.end()
const ll oo=1e18;
const ll mod=1e9+7;
const int base=31;
const ll maxN=3e5+5;
const int tx[4]={0,1,0,-1};
const int ty[4]={1,0,-1,0};
const ll maxM=maxN*4+5;
const ll block=500;
typedef pair<long double, long double> pdd;
ll n;
void solve()
{
cin>>n;
stack<pdd> p;
cout<<fixed<<setprecision(3);
forw(i,1,n)
{
long double x,r; cin>>x>>r;
while (p.size())
{
long double new_r=(x-p.top().fi)*(x-p.top().fi)/(4*p.top().se);
r=min(new_r,r);
if (p.top().se<=r) p.pop();
else break;
}
p.pu({x,r});
cout<<r<<"\n";
}
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
//freopen("test.inp","r",stdin);
//freopen("test.out","w",stdout);
//freopen("test.inp","r",stdin);
//freopen("test.out","w",stdout);
int t=1; //cin>>t;
while (t--) solve();
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... |