Submission #570509

# Submission time Handle Problem Language Result Execution time Memory
570509 2022-05-30T10:31:08 Z NeriW Balloons (CEOI11_bal) C++17
10 / 100
240 ms 18380 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<ll> vll;
typedef long double ld;
typedef vector<ld> vld;
typedef pair<ld, ld> pld;
typedef vector<pld> vpld;
const ll inf = 1e18;
ld nr(ld x1, ld x2, ld r1)
{
    return ((x1-x2)*(x1-x2))/(4*r1); 
}
int main()
{
    //freopen("..\\io\\input.txt", "r", stdin);
    //freopen("..\\io\\output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    int n; cin >> n;
    vpld v(n);
    vld ans(n);
    vpll a(n, {-1, n});
    for(int i = 0; i < n; i++)
    {
        cin >> v[i].first >> v[i].second;
    }
    stack<pld> s;
    for(int i = 0; i < n; i++)
    {
        ld r = inf;
       while(!s.empty())
       {
           ld ri =  nr(s.top().first , v[i].first , ans[s.top().second]);
           if(ri < r && ri <= v[i].second)
           {
               r = ri;
               s.pop();
           }
           else break;
       }
       ans[i] = min(v[i].second, r);
       s.push({v[i].first, i});
    }
    cout << fixed << setprecision(3);
    for(auto a : ans)
        cout << a << "\n";
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB 5th numbers differ - expected: '17.1630000000', found: '99.0000000000', error = '81.8370000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB 3rd numbers differ - expected: '0.0420000000', found: '3.0000000000', error = '2.9580000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 476 KB 114th numbers differ - expected: '39.0180000000', found: '56.0000000000', error = '16.9820000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 23 ms 2096 KB 196th numbers differ - expected: '100.7250000000', found: '111.0000000000', error = '10.2750000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 57 ms 4896 KB 13945th numbers differ - expected: '0.0140000000', found: '7.0000000000', error = '6.9860000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 120 ms 9508 KB 7236th numbers differ - expected: '0.0070000000', found: '7.0000000000', error = '6.9930000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 155 ms 10868 KB 4645th numbers differ - expected: '0.0260000000', found: '8.0000000000', error = '7.9740000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 181 ms 14508 KB 1730th numbers differ - expected: '5.6890000000', found: '6.8060000000', error = '1.1170000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 240 ms 18380 KB 2716th numbers differ - expected: '22.1690000000', found: '43.0000000000', error = '20.8310000000'
2 Halted 0 ms 0 KB -