Submission #746301

#TimeUsernameProblemLanguageResultExecution timeMemory
746301kr_2003Balloons (CEOI11_bal)C++14
0 / 100
11 ms612 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...