Submission #746301

# Submission time Handle Problem Language Result Execution time Memory
746301 2023-05-22T09:09:17 Z kr_2003 Balloons (CEOI11_bal) C++14
0 / 100
11 ms 612 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("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif

// #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;
}

Compilation message

bal.cpp: In function 'int main()':
bal.cpp:17:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |   freopen("input.txt", "r", stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
bal.cpp:18:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |   freopen("output.txt", "w", stdout);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 596 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 612 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 596 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 608 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 596 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 608 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 612 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 596 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 596 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 608 KB Unexpected end of file - double expected
2 Halted 0 ms 0 KB -