Submission #492242

# Submission time Handle Problem Language Result Execution time Memory
492242 2021-12-06T05:51:58 Z darkowl Balloons (CEOI11_bal) C++14
10 / 100
211 ms 5016 KB
/// I in it to win it !

#include <bits/stdc++.h>
using namespace std;

#define ll                       long long
#define int ll
#define F                        first
#define S                        second
#define mp                       make_pair
#define pii                      pair<int, int>
#define pb                       push_back
#define pf                       push_front
#define arr_fill(a, n)           for(ll i = 0 ; i < n ; i++){cin >> a[i];}
#define arr_fill_sum(a,n,sum)    for (ll i = 0 ; i < n ; i++){cin >> a[i];sum+=a[i];}
#define arr_out(a,n)             for (ll i = 0 ; i < n ; i++){cout << a[i] <<" ";}
#define fast                     ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const ll MAXN = 1e6 + 5;
const ll MOD = 1e9 + 7;
const ll INF = 1e18 + 7;
ll pw(ll a, ll b){return b == 0 ? 1LL : (pw(a * a  , b / 2) * (b % 2 == 0 ? 1LL : a));}
stack < pair<int, double> > s;
double vd, x[MAXN], r[MAXN];

void solve ()
{
    int n; cin >> n ;
    cout << fixed << setprecision(3);
    cin >> x[0] >> r[0];
    s.push({0, r[0]}); cout << r[0] <<"\n";
    for(int i = 1; i < n; i++)
    {
        cin >> x[i] >> r[i];
        while (!s.empty())
        {
            r[i] = min(r[i], ((double)(pw(x[i] - x[s.top().F], 2)/(4 * (s.top().S)))));
            if ( r[i] >= s.top().S){s.pop();}
            else {break;}
        }
        s.push({i, vd});
        cout << r[i] <<"\n";
    }
}


int32_t main()
{
    fast
    int t = 1; //cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}

///Thanks GOD :))
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB 4th numbers differ - expected: '1.8420000000', found: '87.0000000000', error = '85.1580000000'
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB 7th numbers differ - expected: '0.0010000000', found: '9.0000000000', error = '8.9990000000'
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 332 KB 3rd numbers differ - expected: '121.0000000000', found: '123.0000000000', error = '2.0000000000'
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 724 KB 3rd numbers differ - expected: '211.0000000000', found: '213.0000000000', error = '2.0000000000'
# Verdict Execution time Memory Grader output
1 Incorrect 55 ms 1456 KB 5th numbers differ - expected: '15395.0000000000', found: '15396.0000000000', error = '1.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 113 ms 2720 KB 3rd numbers differ - expected: '7936.0000000000', found: '10352.0000000000', error = '2416.0000000000'
# Verdict Execution time Memory Grader output
1 Incorrect 133 ms 3136 KB 5th numbers differ - expected: '5054.0000000000', found: '5055.0000000000', error = '1.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 172 ms 4148 KB 3rd numbers differ - expected: '1872.0000000000', found: '1874.0000000000', error = '2.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 211 ms 5016 KB 3rd numbers differ - expected: '2960.0000000000', found: '2962.0000000000', error = '2.0000000000'
2 Halted 0 ms 0 KB -