//#pragma GCC optimize("O3,unroll-loops,Ofast")
//#pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")
#include <bits/stdc++.h>
//#include <cstdio>
//#include <iostream>
using namespace std;
#define MAX 100007
#define pb push_back
#define mp make_pair
#define int long long
#define f first
#define s second
#define vi vector<int>
#define pii pair<int,int>
#define si set<int>
#define vpii vector<pair<int,int>>
const int mod = 2019201997;
const int INF = 1e18;
// myMap.begin()->first : key
// myMap.begin()->second : value
int epow(int a,int b){int ans=1;while(b){if(b&1) ans*=a;a*=a;/*ans%=mod;a%=mod;*/b>>=1;}return ans/*%mod*/;}
int gcd(int a,int b) {if(a<b)swap(a,b);while(b){int tmp=b;b=a%b;a=tmp;}return a;}
int mul(int a,int b){return ((a%mod)*(b%mod))%mod;}
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};
struct DSU {
vi e,sayi; void init(int N) { e = vi(N,-1); sayi = vi(N);}
int get(int x) { return e[x] < 0 ? x : e[x] = get(e[x]); }
bool sameSet(int a, int b) { return get(a) == get(b); }
int size(int x) { return -e[get(x)]; }
bool unite(int x, int y) { // union by size
x = get(x), y = get(y); if (x == y) return 0;
if (e[x] > e[y]) swap(x,y);
e[x] += e[y]; e[y] = x; sayi[x]+=sayi[y]; return 1;
}
};
int sq(int a) {
return 1LL * a * a;
}
long double calc(int a,int b)
{
long double ans =sq(a);
ans /= 4*b;
return ans;
}
void solve()
{
int n; cin >> n;
vector<pair<int,long double>> v(n+2);
for(int i=1;i<=n;i++) cin >> v[i].f >> v[i].s;
stack<int> st;
vector<long double> ans(n+2,INF);
for(int i=1;i<=n;i++)
{
ans[i]=(long double)v[i].s;
while(st.size())
{
int node=st.top();
ans[i]=min(ans[i],calc(v[i].f-v[node].f,ans[node]));
if(ans[i]>=ans[node]) st.pop();
else break;
}
st.push(i);
}
for(int i=1;i<=n;i++) printf("%.9Lf\n",ans[i]);
return;
}
int32_t main() {
// freopen("walk.in", "r", stdin);
// freopen("walk.out", "w", stdout);
ios_base::sync_with_stdio(0);cin.tie(0);
int t=1;
// cin >> t;
while (t--) solve();
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
8th numbers differ - expected: '8.7410000000', found: '9.0909090910', error = '0.3499090910' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
2 numbers |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
13th numbers differ - expected: '2.3960000000', found: '2.4500000000', error = '0.0540000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
3rd numbers differ - expected: '121.0000000000', found: '121.0020491800', error = '0.0020491800' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
11 ms |
1628 KB |
71st numbers differ - expected: '136.0000000000', found: '136.0018248180', error = '0.0018248180' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
28 ms |
3416 KB |
254th numbers differ - expected: '15129.9990000000', found: '15130.0013391970', error = '0.0023391970' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
58 ms |
6484 KB |
286th numbers differ - expected: '7633.9990000000', found: '7634.0008192420', error = '0.0018192420' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
67 ms |
7568 KB |
512th numbers differ - expected: '4502.9990000000', found: '4503.0045060080', error = '0.0055060080' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
92 ms |
9808 KB |
165th numbers differ - expected: '1698.9980000000', found: '1699.0001472320', error = '0.0021472320' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
106 ms |
12628 KB |
249th numbers differ - expected: '2683.0090000000', found: '2683.0112286560', error = '0.0022286560' |
2 |
Halted |
0 ms |
0 KB |
- |