Submission #746303

# Submission time Handle Problem Language Result Execution time Memory
746303 2023-05-22T09:12:50 Z kr_2003 Balloons (CEOI11_bal) C++14
30 / 100
480 ms 10924 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double

double sq(double a) {
  return a * a;
}

signed main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);



// #ifndef ONLINE_JUDGE
//   freopen("cowland.in", "r", stdin);
//   freopen("cowland.out", "w", stdout);
// #endif
  int n; cin >> n;
  double x[n], r[n];
  double r_f[n];
  for (int i = 0; i < n; ++i)
  {
    cin >> x[i];
    cin >> r[i];
  }
  stack<int>st;
  for (int i = 0; i < n; ++i)
  {
    // if (st.size()) cout << st.top() << endl;
    while (st.size()) {
      double rad = sq(x[i] - x[st.top()]) / (4 * r_f[st.top()]);
      r[i] = min(r[i], rad);
      // cout << r[i] << endl;
      if (r[i] >= r_f[st.top()]) {
        st.pop();
        continue;
      } else break;
    }
    r_f[i] = r[i];
    st.push(i);

  }
  for (int i = 0; i < n; ++i)
  {
    cout << r_f[i] << endl;
  }



  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB 1st numbers differ - expected: '247294217.0000000000', found: '247294000.0000000000', error = '217.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 340 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 5 ms 340 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 44 ms 1268 KB 2953rd numbers differ - expected: '1030.4380000000', found: '1030.4400000000', error = '0.0020000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 120 ms 3204 KB 251st numbers differ - expected: '15123.0020000000', found: '15123.0000000000', error = '0.0020000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 277 ms 5608 KB 285th numbers differ - expected: '7629.0020000000', found: '7629.0000000000', error = '0.0020000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 286 ms 6436 KB 511th numbers differ - expected: '4494.0050000000', found: '4494.0100000000', error = '0.0050000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 364 ms 8392 KB 164th numbers differ - expected: '1698.0020000000', found: '1698.0000000000', error = '0.0020000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 480 ms 10924 KB 248th numbers differ - expected: '2694.0020000000', found: '2694.0000000000', error = '0.0020000000'
2 Halted 0 ms 0 KB -