# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
872729 |
2023-11-13T15:57:34 Z |
8pete8 |
Balloons (CEOI11_bal) |
C++14 |
|
139 ms |
12748 KB |
#include<iostream>
#include<stack>
#include<map>
#include<vector>
#include<string>
#include<unordered_map>
#include <queue>
#include<cstring>
#include<limits.h>
#include<cmath>
#include<set>
#include<algorithm>
#include<bitset>
#include <iomanip>
using namespace std;
#define ll long long
#define f first
#define endl "\n"
#define s second
#define pii pair<int,int>
#define ppii pair<pii,pii>
#define vi vector<int>
#define pb push_back
//#define p push
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define F(n) for(int i=0;i<n;i++)
#define lb lower_bound
#define ub upper_bound
#define fastio ios::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
#define int long long
#define double long double
const int mxn=1e5,inf=1e18;
double cal(int x,double r){return (double)(((x*x)*1.0)/(4*r*1.0));}
deque<int>dq;
int32_t main(){
fastio
int n;cin>>n;
vector<pair<int,double>>v(n);
vector<double>sz(n,0.000);
for(int i=0;i<n;i++)cin>>v[i].f>>v[i].s;
for(int i=0;i<n;i++){
if(dq.empty()){
sz[i]=v[i].s;
dq.push_back(i);
continue;
}
while(dq.size()>1&&(cal(v[i].f-v[dq[dq.size()-1]].f,sz[dq[dq.size()-1]])>cal(v[i].f-v[dq[dq.size()-2]].f,sz[dq[dq.size()-2]])))dq.pop_back();
sz[i]=min(v[i].s,cal(v[i].f-v[dq.back()].f,sz[dq.back()]));
while(!dq.empty()&&(sz[i]>=sz[dq.back()])){
sz[i]=min(sz[i],cal(v[i].f-v[dq.back()].f,sz[dq.back()]));
dq.pop_back();
}
dq.push_back(i);
}
cout<<setprecision(3)<<fixed;
for(auto i:sz)cout<<i<<'\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
252nd numbers differ - expected: '4.6580000000', found: '5.0000000000', error = '0.3420000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
344 KB |
2000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
15 ms |
1624 KB |
20000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
36 ms |
3860 KB |
26317th numbers differ - expected: '1.1140000000', found: '16.4820000000', error = '15.3680000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
73 ms |
6992 KB |
7458th numbers differ - expected: '1.9040000000', found: '8.0000000000', error = '6.0960000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
89 ms |
7760 KB |
4889th numbers differ - expected: '0.7110000000', found: '8.0000000000', error = '7.2890000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
112 ms |
10260 KB |
78048th numbers differ - expected: '3.7750000000', found: '3.8270000000', error = '0.0520000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
139 ms |
12748 KB |
4263rd numbers differ - expected: '0.6980000000', found: '4.0000000000', error = '3.3020000000' |
2 |
Halted |
0 ms |
0 KB |
- |