Submission #954057

#TimeUsernameProblemLanguageResultExecution timeMemory
954057blackslexBalloons (CEOI11_bal)C++17
100 / 100
90 ms8500 KiB
#include<bits/stdc++.h> using namespace std; int n; int main() { scanf("%d", &n); vector<int> x(n), r(n); vector<double> dp(n); // dp[i] = min {0<=j<i} {(x[i]-x[j])*(x[i]-x[j]) / 4*dp[j]} for (int i = 0; i < n; i++) scanf("%d %d", &x[i], &r[i]), dp[i] = (double) r[i]; stack<int> st; for (int i = 0; i < n; i++) { while (!st.empty() && (dp[i] = min(dp[i], (double) 1.0 * (x[st.top()] - x[i]) * (x[st.top()] - x[i]) / (4.0 * dp[st.top()]))) >= dp[st.top()]) st.pop(); st.emplace(i); } for (int i = 0; i < n; i++) printf("%.3lf\n", dp[i]); }

Compilation message (stderr)

bal.cpp: In function 'int main()':
bal.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
bal.cpp:12:38: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     for (int i = 0; i < n; i++) scanf("%d %d", &x[i], &r[i]), dp[i] = (double) r[i];
      |                                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
#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...