Submission #1020019

# Submission time Handle Problem Language Result Execution time Memory
1020019 2024-07-11T12:55:54 Z julia_08 Balloons (CEOI11_bal) C++17
0 / 100
142 ms 2220 KB
#include <bits/stdc++.h>
using namespace std;

const double w = 0.0001;

double solve(int x1, int x2, double r2){
  return ((x2 - x1)*(x2 - x1))/(4*r2) - w;
}

int main(){
  cin.tie(0)->sync_with_stdio(0);

  int n; cin >> n;

  stack<pair<double, double>> q;

  for(int i=1; i<=n; i++){
    double x, r; cin >> x >> r;
    while(!q.empty() && q.top().second <= r){
      r = min(r, solve(x, q.top().first, q.top().second));
      q.pop();
    }

    if(!q.empty()) r = min(r, solve(x, q.top().first, q.top().second));

    cout << fixed << setprecision(3) << r << "\n";
    q.push({x, r});
  }

  return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 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 Incorrect 1 ms 344 KB 2nd numbers differ - expected: '252735385.4379999936', found: '0.9330000000', error = '252735384.5049999952'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB 30th numbers differ - expected: '5.5990000000', found: '14.9870000000', error = '9.3880000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 348 KB 148th numbers differ - expected: '8.2380000000', found: '26.0000000000', error = '17.7620000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 20 ms 604 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 35 ms 860 KB 4th numbers differ - expected: '15396.0000000000', found: '-8148.5510000000', error = '23544.5510000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 70 ms 1392 KB 14th numbers differ - expected: '7919.0000000000', found: '-64224.1280000000', error = '72143.1280000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 92 ms 1400 KB 7th numbers differ - expected: '5052.0000000000', found: '-85953.8200000000', error = '91005.8200000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 111 ms 1968 KB 25th numbers differ - expected: '1850.0000000000', found: '-263697.1150000000', error = '265547.1150000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 142 ms 2220 KB 16th numbers differ - expected: '2946.0000000000', found: '-174851.9200000000', error = '177797.9200000000'
2 Halted 0 ms 0 KB -