Submission #657628

#TimeUsernameProblemLanguageResultExecution timeMemory
657628cpp219Balloons (CEOI11_bal)C++17
100 / 100
230 ms5556 KiB
#include<bits/stdc++.h> #define ll long long #define ld double #define fs first #define sc second #define debug(y) cout<<y,exit(0) using namespace std; typedef pair<ll,ll> LL; const ll N = 1e6 + 9; const ll inf = 1e18 + 7; ll n; stack<pair<ld,ld>> st; int main(){ ios_base::sync_with_stdio(NULL); cin.tie(0); cout.tie(0); #define task "test" if (fopen(task".inp","r")){ freopen(task".inp","r",stdin); //freopen(task".out","w",stdout); } cin>>n; for (ll i = 1;i <= n;i++){ ld x,r; cin>>x>>r; while(!st.empty()){ ld x1 = st.top().fs,r1 = st.top().sc; r = min(r,((x1 - x)*(x1 - x))/(4*r1)); if (r < r1) break; else st.pop(); } st.push({x,r}); cout<<fixed<<setprecision(3)<<r<<"\n"; } } /* be confident */

Compilation message (stderr)

bal.cpp: In function 'int main()':
bal.cpp:19:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |         freopen(task".inp","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
#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...