Submission #502441

#TimeUsernameProblemLanguageResultExecution timeMemory
502441chenwzMobile (BOI12_mobile)C++11
100 / 100
372 ms24604 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) int main() { int N, L; scanf("%d%d", &N, &L); vector<int> X(N), Y(N); _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, right = 0; _for(i, 0, N) { double y = Y[i], dx = sqrt(m * m - y * y), a = X[i] - dx, b = X[i] + dx; if (a <= right) right = max(right, b); if (right >= L) break; } (right >= L ? r : l) = m; } printf("%.4lf\n", l); return 0; } // 499716 Mobile (BOI12_mobile) C++11 100 / 100 405ms 27384KB

Compilation message (stderr)

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