Submission #746302

# Submission time Handle Problem Language Result Execution time Memory
746302 2023-05-22T09:11:08 Z kr_2003 Balloons (CEOI11_bal) C++14
20 / 100
478 ms 13580 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 (sq(x[i] - x[st.top()]) / (4 * r_f[st.top()]) > 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 1 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 Incorrect 5 ms 452 KB 504th numbers differ - expected: '160.9360000000', found: '163.0000000000', error = '2.0640000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 46 ms 1560 KB 653rd numbers differ - expected: '96.2810000000', found: '123.0000000000', error = '26.7190000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 117 ms 3804 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 272 ms 6904 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 303 ms 8028 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 366 ms 10616 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 478 ms 13580 KB 248th numbers differ - expected: '2694.0020000000', found: '2694.0000000000', error = '0.0020000000'
2 Halted 0 ms 0 KB -