Submission #925466

# Submission time Handle Problem Language Result Execution time Memory
925466 2024-02-11T17:00:15 Z BoopyTheNoob Balloons (CEOI11_bal) C++14
10 / 100
126 ms 10448 KB
#include <bits/stdc++.h>
using namespace std;

void subtask1 (vector<pair<double, double>> info) {
    vector<double> ans(info.size());
    ans[0] = info[0].second;
    for (int i = 1; i < info.size(); i++) {
        double pans = 1e9;
        for (int j = 0; j < i; j++)
            pans = min(pans, (info[i].first - info[j].first) * (info[i].first - info[j].first) / (4 * ans[j]));
        ans[i] = min(pans, info[i].second);
    }
    for (auto x: ans) printf("%.3lf\n", x);
}

void subtask2 (vector<pair<double, double>> info) {
    vector<double> ans(info.size());
    vector<pair<double, double>> q;
    ans[0] = info[0].second;
    q.push_back({info[0].first, ans[0]});
    for (int i = 1; i < info.size(); i++) {
        double pans = info[i].second;
        int j = q.size() - 1;
        for (; j >= 0; j--) {
            double span = (info[i].first - q[j].first) * (info[i].first - q[j].first) / (4 * q[j].second);
            if (span <= pans) pans = span;
            else break;
        }
        ans[i] = pans;
        for (int k = j + 1; k < q.size(); k++)
            q.pop_back();
        q.push_back({info[i].first, ans[i]});
    }
    for (auto x: ans) printf("%.3lf\n", x);
}

int main (void) {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin >> n;
    vector<pair<double, double>> info(n);
    for (int i = 0; i < n; i++)
        cin >> info[i].first >> info[i].second;
    subtask2(info);
    return 0;
}

Compilation message

bal.cpp: In function 'void subtask1(std::vector<std::pair<double, double> >)':
bal.cpp:7:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<double, double> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 |     for (int i = 1; i < info.size(); i++) {
      |                     ~~^~~~~~~~~~~~~
bal.cpp: In function 'void subtask2(std::vector<std::pair<double, double> >)':
bal.cpp:21:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<double, double> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |     for (int i = 1; i < info.size(); i++) {
      |                     ~~^~~~~~~~~~~~~
bal.cpp:30:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<double, double> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |         for (int k = j + 1; k < q.size(); k++)
      |                             ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 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 0 ms 348 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 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 2 ms 348 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 13 ms 1372 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 32 ms 3036 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 64 ms 5480 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 76 ms 6352 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 100 ms 8324 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 126 ms 10448 KB 2716th numbers differ - expected: '22.1690000000', found: '43.0000000000', error = '20.8310000000'
2 Halted 0 ms 0 KB -