Submission #1208107

#TimeUsernameProblemLanguageResultExecution timeMemory
1208107pete555Balloons (CEOI11_bal)C++20
100 / 100
107 ms3540 KiB
#include<bits/stdc++.h> using namespace std; #define pi pair<int,int> #define ll long long #define pb push_back #define pf push_front void fileIO(string filename) { freopen((filename + ".in").c_str(), "r", stdin); freopen((filename + ".out").c_str(), "w", stdout); } int main() { cin.tie(0)->sync_with_stdio(false); //fileIO(""); int n; cin >> n; vector<double> ans(n); stack<pair<double, double>> S; for(int i = 0; i < n; i++) { double x, r; cin >> x >> r; double max_r = r; while(S.size()) { pair<double, double> a = S.top(); double b_r = (a.first - x) * (a.first - x) / (4 * a.second); max_r = min(max_r, b_r); if(max_r >= a.second) { S.pop(); continue; } else { break; } } ans[i] = max_r; S.push({x, max_r}); } cout << fixed << setprecision(3); for(double x : ans) cout << x << '\n'; }

Compilation message (stderr)

bal.cpp: In function 'void fileIO(std::string)':
bal.cpp:10:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |         freopen((filename + ".in").c_str(), "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bal.cpp:11:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |         freopen((filename + ".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...