Submission #1100989

#TimeUsernameProblemLanguageResultExecution timeMemory
1100989hoangteo0103Mobile (BOI12_mobile)C++17
100 / 100
734 ms35400 KiB
#include "bits/stdc++.h" using namespace std; void setIO(string s){ ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); if(fopen("trash.in", "r")) freopen("trash.in", "r", stdin) , freopen("trash.out", "w", stdout); } int main(){ setIO("hoangteo0103"); int n, len; cin >> n >> len; vector<array<double, 2>> a(n); for(int i = 0 ; i < n ; i++) cin >> a[i][0] >> a[i][1]; double ans; auto check = [&](double lim) -> bool { double prev = 0; for(int i = 0 ; i < n ; i++) { double edge = sqrt(lim * lim - a[i][1] * a[i][1]) ; double l = a[i][0] - edge, r = a[i][0] + edge; if(l <= prev) prev = max(prev, r); } return prev >= len; }; double l = 0, r = 1.5e9; while(r - l > 1e-6) { double mid = (l+r)/2; if(check(mid)) { ans = mid ; r = mid; } else { l = mid; } } cout << fixed << setprecision(6) << ans; }

Compilation message (stderr)

mobile.cpp: In function 'void setIO(std::string)':
mobile.cpp:7:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |  freopen("trash.in", "r", stdin) , freopen("trash.out", "w", stdout);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
mobile.cpp:7:43: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |  freopen("trash.in", "r", stdin) , freopen("trash.out", "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...
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...