Submission #941473

# Submission time Handle Problem Language Result Execution time Memory
941473 2024-03-09T01:48:39 Z quan606303 Balloons (CEOI11_bal) C++14
50 / 100
2000 ms 6576 KB
///0-0 : what is your motivation, quan606303?
///quan606303 : Hutao
/*idea : 



*/
#include <bits/stdc++.h>
#define int long long
#define ll long long
#define INTMAX INT_MAX
#define INTMIN INT_MIN
#define LONGMAX LLONG_MAX
#define LONGMIN LLONG_MIN
#define fi first
#define se second
#define memfull(a,b) memset(a,b,sizeof(a));
#define endl '\n'
#define file(a) freopen(a".inp","r",stdin); freopen(a".out","w",stdout);
using namespace std;
const int MOD=1e9+7;
const int maxn=200005;
pair<int,int> a[maxn];
int n;
long double ans[maxn];
long double sqr(long double k)
{
    return k*k;
}
long double cal(pair<long double,long double> x, long double pos)
{
    return sqr(pos-x.fi)/(4*x.se);
}
void solve()
{
    stack<pair<long double,long double> > st;
    //st.push()
    for (int i=1;i<=n;i++)
    {
        long double r=a[i].se;
        for (int j=i-1;j>=1;j--)
        {
            r=min(r,cal({a[j].fi,ans[j]},a[i].fi));
        }
        ans[i]=r;
    }
    for (int i=1;i<=n;i++)cout<<setprecision(3)<<fixed<<ans[i]<<endl;
}
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //file("");
    cin>>n;
    for (int i=1;i<=n;i++)cin>>a[i].fi>>a[i].se;
    solve();
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 9 ms 2396 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 733 ms 4880 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Execution timed out 2093 ms 4688 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2033 ms 4992 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2007 ms 5620 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2049 ms 5888 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2063 ms 6576 KB Time limit exceeded
2 Halted 0 ms 0 KB -