Submission #499716

#TimeUsernameProblemLanguageResultExecution timeMemory
499716chenwzMobile (BOI12_mobile)C++11
100 / 100
405 ms27384 KiB
// BalticOI2012 - Mobile #include <bits/stdc++.h> using namespace std; using LL = long long; #define _for(i, a, b) for (int i = (a); i < (int)(b); ++i) const int NN = 1e6 + 4; int X[NN], Y[NN]; int main() { int N, L; scanf("%d%d", &N, &L); _for(i, 0, N) scanf("%d%d", X + i, Y + i); double l = 1, r = 1.5e9; while (r - l > 1e-3) { double m = (l + r) / 2, curr = 0; _for(i, 0, N) { double x = X[i], y = Y[i], delta = sqrt(m * m - y * y), a = x - delta, b = x + delta; if (a <= curr) curr = max(curr, b); if(curr >= L) break; } (curr >= L ? r : l) = m; } printf("%.4lf\n", l); return 0; }

Compilation message (stderr)

mobile.cpp: In function 'int main()':
mobile.cpp:10:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |   scanf("%d%d", &N, &L);
      |   ~~~~~^~~~~~~~~~~~~~~~
mobile.cpp:11:22: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |   _for(i, 0, N) scanf("%d%d", X + i, Y + i);
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~
#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...