제출 #648769

#제출 시각아이디문제언어결과실행 시간메모리
648769wyhong3103Balloons (CEOI11_bal)C++14
80 / 100
2072 ms12640 KiB
#include <bits/stdc++.h> #define all(x) begin(x),end(x) #define fir first #define sec second #define sz(x) x.size() #define pb push_back using namespace std; using ll = long long; using vi = vector<int>; using pi = pair<int,int>; using db = double; using ldb = long double; using pldb = pair<ldb, ldb>; using pdb = pair<db,db>; using pll = pair<ll,ll>; using vll = vector<ll>; const double EPS = (1e-6); void setio(string s){ freopen((s + ".in").c_str(),"r",stdin); freopen((s + ".out").c_str(),"w",stdout); } ldb dist(pldb a, pldb b){ return hypot(abs(a.fir-b.fir), abs(a.sec-b.sec)); } void solve(){ int n; cin >> n; vector<pldb> a(n); for(auto& i : a) cin >> i.fir >> i.sec; vector<ldb> res(n); //{loc, radius}, monotonic radius stack<pldb> s; for(int i{}; i < n; i++){ ldb cur_hi = a[i].sec; while (!s.empty()){ ldb lo = 0, hi = cur_hi; for(int j{}; j < 100; j++){ ldb mid = lo + (hi-lo)/2; if (dist(s.top(), {a[i].fir, mid}) > mid+s.top().sec) lo = mid; else hi = mid; } cur_hi = lo; if (lo > s.top().sec){ s.pop(); }else break; } res[i] = cur_hi; s.push({a[i].fir, cur_hi}); } cout << setprecision(8) << fixed; for(auto& i : res) cout << i << '\n'; } int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int t = 1; while(t--){ solve(); } return 0; }

컴파일 시 표준 에러 (stderr) 메시지

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