Submission #1134802

#TimeUsernameProblemLanguageResultExecution timeMemory
1134802goulthenMobile (BOI12_mobile)C++20
0 / 100
408 ms16916 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define ll long long #define pii pair<int, int> #define pll pair<ll, ll> #define fi first #define se second #define rep(i, a, b) for (auto i = a; i <= b; ++i) #define per(i, b, a) for (auto i = b; i >= a; --i) #define pb push_back #define eb emplace_back #define all(v) (v).begin(), (v).end() #define lsb(x) (x)&(-x) void setIO(string name = "") { ios_base::sync_with_stdio(false); cin.tie(nullptr);cout.tie(nullptr); if (!name.empty()) { freopen((name + ".in").c_str(), "r", stdin); freopen((name + ".out").c_str(), "w", stdout); } } ll fexp(ll a, ll b, ll m) { ll p = a; ll ans = 1; while (b > 0) { if (b % 2 != 0) ans = (ans*p)%m; p = (p*p)%m; b >>= 1; } return ans; } const int MAXN = 2e5 + 10; const int INF = 1e18 + 5; const int MOD = 1e9 + 7; pii a[MAXN]; typedef long double dl; void solve() { int n,l; cin >> n >> l; vector<pii> pos; int cx, by; cin >> cx >> by; rep (i, 2, n) { int x,y; cin >> x >> y; if (x != cx){ pos.pb({cx,by}); cx = x, by = y; continue; } if (abs(y) < abs(by)) by = y; } pos.pb({cx,by}); dl lo = 0, hi = 3e9,eps = 1e-8; while ((hi-lo)>eps) { dl mid = (lo + hi) / 2; dl cl=INF,cr=-1; bool ok = true; for (const auto &[xi,yi] : pos) { if (mid*mid < yi*yi) continue; dl sq = sqrt(mid*mid - yi*yi); dl li = xi - sq, ri = xi + sq; if (cr != -1 && cr < li) { ok = false; break; } cl = min(cl,li); cr = max(cr,ri); } if (ok && cl <= 0 && cr >= l) hi = mid; else lo = mid; } cout << fixed << setprecision(8) << hi << '\n'; } int32_t main() { setIO(); int tt = 1; //cin >> tt; while (tt-- > 0) solve(); }

Compilation message (stderr)

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