Submission #1020034

# Submission time Handle Problem Language Result Execution time Memory
1020034 2024-07-11T13:08:19 Z julia_08 Balloons (CEOI11_bal) C++17
20 / 100
191 ms 7200 KB
#include <bits/stdc++.h>
using namespace std;

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

ld solve(ld x1, ld 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()){
      r = min(r, solve(x, q.top().first, q.top().second));

      if(q.top().second > r) break;
      q.pop();
    }

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

  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB 354th numbers differ - expected: '215.9480000000', found: '215.9460000000', error = '0.0020000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 468 KB 397th numbers differ - expected: '137.2240000000', found: '137.2290000000', error = '0.0050000000'
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: '100.7270000000', error = '0.0020000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 44 ms 2388 KB 13945th numbers differ - expected: '0.0140000000', found: '-1392426.5379999999', error = '1392426.5519999999'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 95 ms 4176 KB 7236th numbers differ - expected: '0.0070000000', found: '-649163.0900000000', error = '649163.0970000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 109 ms 4692 KB 4655th numbers differ - expected: '0.0040000000', found: '-375441.4870000000', error = '375441.4910000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 148 ms 5968 KB 1734th numbers differ - expected: '1856.0220000000', found: '1856.0390000000', error = '0.0170000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 191 ms 7200 KB 2723rd numbers differ - expected: '859.0470000000', found: '859.0130000000', error = '0.0340000000'
2 Halted 0 ms 0 KB -