Submission #970993

#TimeUsernameProblemLanguageResultExecution timeMemory
970993hgmhcMobile (BOI12_mobile)C++17
100 / 100
393 ms35448 KiB
#include <bits/stdc++.h> using namespace std; using ii = pair<int,int>; using ll = long long; using vi = vector<int>; #define rep(i,a,b) for (auto i = (a); i <= (b); ++i) #define per(i,a,b) for (auto i = (b); i >= (a); --i) #define all(x) begin(x), end(x) #define siz(x) int((x).size()) #define Mup(x,y) (x = max(x,y)) #define mup(x,y) (x = min(x,y)) #define fi first #define se second #define pb push_back #define dbg(...) fprintf(stderr,__VA_ARGS__) #pragma region Geometry #define pt complex<coord_t> #define TCT template <typename coord_t> using ld = long double; const ld PI = acos(-1.0L), EPS = 1e-9; using Zpt = complex<ll>; using Rpt = complex<ld>; #define X real() #define Y imag() TCT inline coord_t dot(pt u, pt v) { return (conj(u)*v).X; } TCT inline coord_t cross(pt u, pt v) { return (conj(u)*v).Y; } TCT inline coord_t orient(pt a, pt b, pt c) { return cross(b-a,c-b); } TCT inline coord_t abs2(pt u) { return dot(u,u); } TCT inline ld abs1(pt u) { return sqrt(ld(abs2(u))); } TCT istream &operator >> (istream &is, pt &p) { coord_t x, y; is >> x >> y; p = {x,y}; return is; } namespace std { bool operator < (const Zpt &u, const Zpt &v) { return u.X == v.X ? u.Y < v.Y : u.X < v.X; } } #undef pt #undef TCT #pragma endregion using pt = Zpt; const int N = 1e6+3; int n; double l; pt p[N]; int main() { cin.tie(0)->sync_with_stdio(0); cin >> n >> l; rep(i,1,n) cin >> p[i]; auto covered = [](double x) { double ptr = 0; rep(i,1,n) { double dif = sqrt(x*x-p[i].Y*p[i].Y); if (p[i].X-dif < ptr+1e-9) Mup(ptr, p[i].X+dif); } return l < ptr+1e-9; }; double a=0, b=1e10, m; while (b-a > 1e-3) { m = (a+b)/2; if (covered(m)) b = m; else a = m; } cout << fixed << setprecision(6) << m; }

Compilation message (stderr)

mobile.cpp:14: warning: ignoring '#pragma region Geometry' [-Wunknown-pragmas]
   14 | #pragma region Geometry
      | 
mobile.cpp:41: warning: ignoring '#pragma endregion ' [-Wunknown-pragmas]
   41 | #pragma endregion
      |
#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...