Submission #500017

# Submission time Handle Problem Language Result Execution time Memory
500017 2021-12-30T09:26:21 Z BBart888 Balloons (CEOI11_bal) C++14
30 / 100
164 ms 8272 KB
#include <iostream>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include<stack>
#include <set>
#include <cmath>
#include <string>

using namespace std;
using ll = long long;
#define rev(x) reverse(x.begin(),x.end())
#define FOR(i,n) for(int i = 0;i<n;i++)
#define all(x) x.begin(),x.end()

const int INF = 1e9;
const int MAXN = 2e5+111;
const int MOD = 1e9 + 7;
const int MAXS = 250*1000+123;
const pair<int, int> dd[]{ {0,1},{0,-1},{1,0},{-1,0} };



int n;
long double r[MAXN];
int x[MAXN];
long double ans[MAXN];
stack<pair<long double, int>> st;


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    //freopen("fencedin.in", "r", stdin);
    //freopen("fencedin.out", "w", stdout);

    

    cin >> n;

    for (int i = 0; i < n; i++)
        cin >> x[i] >> r[i];


    for (int i = 0; i < n; i++)
    {
        while (!st.empty())
        {
            pair<long double, int> s = st.top();
            r[i] = min(r[i],pow((s.second-x[i]),2)/(4*s.first));
            if (r[i] >= s.first)st.pop();
            else break;
        }
        st.push({r[i],x[i]});
        cout << r[i] << " ";
    }
















    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 316 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 332 KB 1st numbers differ - expected: '247294217.0000000000', found: '247294000.0000000000', error = '217.0000000000'
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 2 ms 332 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 988 KB 2953rd numbers differ - expected: '1030.4380000000', found: '1030.4400000000', error = '0.0020000000'
# Verdict Execution time Memory Grader output
1 Incorrect 42 ms 2688 KB 251st numbers differ - expected: '15123.0020000000', found: '15123.0000000000', error = '0.0020000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 94 ms 4564 KB 285th numbers differ - expected: '7629.0020000000', found: '7629.0000000000', error = '0.0020000000'
# Verdict Execution time Memory Grader output
1 Incorrect 101 ms 5320 KB 511th numbers differ - expected: '4494.0050000000', found: '4494.0100000000', error = '0.0050000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 130 ms 6608 KB 164th numbers differ - expected: '1698.0020000000', found: '1698.0000000000', error = '0.0020000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 164 ms 8272 KB 248th numbers differ - expected: '2694.0020000000', found: '2694.0000000000', error = '0.0020000000'
2 Halted 0 ms 0 KB -