Submission #1077178

# Submission time Handle Problem Language Result Execution time Memory
1077178 2024-08-27T02:34:35 Z serpent_121 Balloons (CEOI11_bal) C++17
0 / 100
419 ms 7320 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;
        double constraint = r;
        while (!s.empty()) {
            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 1 ms 344 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 2 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 5 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 39 ms 1108 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 98 ms 2240 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 232 ms 4180 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 225 ms 4688 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 312 ms 5972 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 419 ms 7320 KB 248th numbers differ - expected: '2694.0020000000', found: '2694.0000000000', error = '0.0020000000'
2 Halted 0 ms 0 KB -