This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) (int)(x).size()
#define ft first
#define sd second
#define pb push_back
#define endl '\n'
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef pair<ll, ll> pll;
typedef vector<pll> vll;
typedef vector<vi> vvi;
#define dbg if(1)
void printbit(int x) {string s="\n";while(x){s=((x%2)?'1':'0')+s;x/=2;} cout<<s;}
const ll MOD = 1e9+7;
const int INF = 1e9;
const int N = 200001;
#define sq(x) ((x)*(x))
void solve(){
int n;
cin>>n;
vll a(n);
for (pll &x:a) cin>>x.ft>>x.sd;
stack<int> s;
double ans[n];
for (int i = 0;i<n;i++){
ans[i] = a[i].sd;
while(!s.empty()){
int tp = s.top();
ans[i] = min(ans[i], sq(a[i].ft-a[tp].ft)/(4*ans[tp]));
if (ans[tp] < ans[i]) s.pop();
else break;
}
s.push(i);
}
for (int i = 0;i<n;i++) cout<<fixed<<setprecision(3)<<ans[i]<<'\n';
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int t = 1;
// cin>>t;
while(t--){
solve();
cout<<endl;
}
}
# | 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... |