#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 break;
}
balon.push({poz,mini});
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 |
1 |
Correct |
0 ms |
212 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
260 KB |
505 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
340 KB |
2000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
57 ms |
928 KB |
20000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
152 ms |
1888 KB |
50000 numbers |
2 |
Correct |
155 ms |
3160 KB |
49912 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
307 ms |
3012 KB |
100000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
336 ms |
3444 KB |
115362 numbers |
2 |
Correct |
348 ms |
7216 KB |
119971 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
440 ms |
4584 KB |
154271 numbers |
2 |
Correct |
592 ms |
11872 KB |
200000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
573 ms |
5208 KB |
200000 numbers |
2 |
Correct |
591 ms |
11828 KB |
199945 numbers |