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>
#include <iostream>
#define f first
#define s second
#define pb push_back
typedef long double ld;
using namespace std;
stack<pair<ld,ld>> balon;
int n;
vector<ld> odp;
void spr(ld poz,ld mini){
while(balon.empty()==0){
ld t_poz=balon.top().f,t_s=balon.top().s;
ld curr_s=(poz-t_poz)*(poz-t_poz)/(4*t_s);
mini=min(curr_s,mini);
curr_s=mini;
if(curr_s>t_s)balon.pop();
else {balon.push({poz,curr_s}); break;}
}
odp.pb(mini);
}
int main()
{
cin>>n;
for(int i=0;i<n;i++){ld a,b; cin>>a>>b; if(i)spr(a,b); else {balon.push({a,b}); odp.pb(b);}}
for(auto i : odp)cout<<fixed<<setprecision(3)<<i<<endl;
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... |