Submission #547043

#TimeUsernameProblemLanguageResultExecution timeMemory
547043mgl_diamondBalloons (CEOI11_bal)C++14
0 / 100
373 ms1740 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; #define ii pair<int, int> #define dd pair<double, double> #define iii pair<int, ii> #define fi first #define se second #define all(x) (x).begin(), (x).end() #define debug(x) cout << "> " << #x << ": " << x << '\n' template<class T> bool maximize(T&a, T b) { if (a<b) return a=b, 1; return 0; } template<class T> bool minimize(T&a, T b) { if (a>b) return a=b, 1; return 0; } void setIO(string name="") { ios::sync_with_stdio(0); cin.tie(0); if (name.size()) freopen((name+".in").c_str(), "r", stdin); if (name.size()) freopen((name+".out").c_str(), "w", stdout); } int n; vector<dd> st; int main() { cin >> n; for(int i=0; i<n; ++i) { double x, r; cin >> x >> r; if (i==0) { st.push_back({x, r}); cout << r << "\n"; continue; } for(int i=st.size()-1; i>=0; --i) { double x1=st[i].fi; double r1=st[i].se; minimize(r, (x1-x)*(x1-x)/(r1*4)); } while (st.back().se<r) st.pop_back(); st.push_back({x, r}); cout << r << "\n"; } }

Compilation message (stderr)

bal.cpp: In function 'void setIO(std::string)':
bal.cpp:20:26: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |  if (name.size()) freopen((name+".in").c_str(), "r", stdin);
      |                   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bal.cpp:21:26: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |  if (name.size()) freopen((name+".out").c_str(), "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...