Submission #1077180

# Submission time Handle Problem Language Result Execution time Memory
1077180 2024-08-27T02:36:38 Z serpent_121 Balloons (CEOI11_bal) C++17
0 / 100
396 ms 7504 KB
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <deque>
#include <numeric>
#include <cmath>
#include <cstring>
#include <climits>
#include <stack>
#include <bitset>
typedef long long ll;
using namespace std;
// https://oj.uz/problem/view/CEOI11_bal

int main() {
    ll n; cin >> n;
    long double inflated[n]; // final inflated radii
    stack<pair<ll,ll>> s;
    for (int i = 0; i<n; i++) {
        ll x,r; cin >> x >> r;
        long double constraint = r;
        while (!s.empty()) {
            long double c = (x-s.top().first)*(x-s.top().first)/(double)(4*s.top().second);
            constraint = min(constraint,c);
            if (constraint > s.top().second) s.pop(); // we are sure that we can inflate to at least s.top().second
            else break; // now we are sure that a stronger constraint cannot be delivered
        }
        inflated[i] = constraint; s.push({x,constraint});
        cout << inflated[i] << '\n';
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB 8th numbers differ - expected: '8.7410000000', found: '9.0909100000', error = '0.3499100000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB 1st numbers differ - expected: '247294217.0000000000', found: '247294000.0000000000', error = '217.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 348 KB 3rd numbers differ - expected: '121.0000000000', found: '121.0020000000', error = '0.0020000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 42 ms 1044 KB 44th numbers differ - expected: '165.0000000000', found: '165.0020000000', error = '0.0020000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 101 ms 2388 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 230 ms 3952 KB 285th numbers differ - expected: '7629.0020000000', found: '7629.0000000000', error = '0.0020000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 229 ms 4676 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 314 ms 6268 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 396 ms 7504 KB 248th numbers differ - expected: '2694.0020000000', found: '2694.0000000000', error = '0.0020000000'
2 Halted 0 ms 0 KB -