Submission #1020024

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

using ld = long double;
const ld w = 0.0001;

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

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

  int n; cin >> n;

  stack<pair<ld, ld>> q;

  for(int i=1; i<=n; i++){
    ld 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 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 Incorrect 0 ms 348 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 600 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 15 ms 608 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 52 ms 824 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 92 ms 1384 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 104 ms 1620 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 125 ms 2008 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 169 ms 2384 KB 16th numbers differ - expected: '2946.0000000000', found: '-174851.9200000000', error = '177797.9200000000'
2 Halted 0 ms 0 KB -