Submission #1020015

# Submission time Handle Problem Language Result Execution time Memory
1020015 2024-07-11T12:53:57 Z julia_08 Balloons (CEOI11_bal) C++17
0 / 100
144 ms 5200 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 1 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 348 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 344 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 14 ms 860 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 43 ms 1592 KB 6th numbers differ - expected: '15394.0000000000', found: '-8165.6100000000', error = '23559.6100000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 80 ms 2896 KB 16th numbers differ - expected: '7917.0000000000', found: '-64320.4600000000', error = '72237.4600000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 83 ms 3152 KB 9th numbers differ - expected: '5050.0000000000', found: '-86161.8040000000', error = '91211.8040000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 113 ms 4180 KB 27th numbers differ - expected: '1848.0000000000', found: '-264654.5150000000', error = '266502.5150000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 144 ms 5200 KB 18th numbers differ - expected: '2944.0000000000', found: '-175317.3330000000', error = '178261.3330000000'
2 Halted 0 ms 0 KB -