Submission #589106

# Submission time Handle Problem Language Result Execution time Memory
589106 2022-07-04T09:26:53 Z jakubd Mobile (BOI12_mobile) C++17
12 / 100
511 ms 24732 KB
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);

  int n, l; cin >> n >> l;

  vector<pair<int, int>> a;
  for (int i = 0; i < n; i++) {
    int x, y; cin >> x >> y;
    a.push_back({x, y});
  }

  double lo = 0, ri = 1e9;
  while (fabs(lo - ri) > 1e-6) {
    double m = (lo + ri) / 2, cur = 0;
    
    for (int i = 0; i < n; i++) {
      double d = sqrt(m * m - a[i].second * a[i].second);
      if (a[i].first - d <= cur) cur = max(cur, a[i].first + d);
    }

    if (cur >= l) ri = m;
    else lo = m;
  }

  cout << fixed << setprecision(12) << lo << "\n";

  return 0;
};
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 324 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 340 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 468 KB Output is correct
2 Correct 4 ms 456 KB Output is correct
3 Correct 4 ms 468 KB Output is correct
4 Incorrect 4 ms 460 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 468 KB Output is correct
2 Correct 3 ms 468 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Incorrect 5 ms 468 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 468 KB Output is correct
2 Correct 2 ms 468 KB Output is correct
3 Correct 2 ms 456 KB Output is correct
4 Incorrect 5 ms 504 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 42 ms 2260 KB Output is correct
2 Incorrect 42 ms 2528 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 32 ms 2108 KB Output is correct
2 Correct 36 ms 2256 KB Output is correct
3 Incorrect 49 ms 2388 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 26 ms 2132 KB Output is correct
2 Incorrect 45 ms 2620 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 42 ms 2712 KB Output is correct
2 Incorrect 56 ms 2584 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 52 ms 2704 KB Output is correct
2 Incorrect 50 ms 2576 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 216 ms 8604 KB Output is correct
2 Incorrect 248 ms 12056 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 237 ms 12564 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 270 ms 13316 KB Output is correct
2 Incorrect 258 ms 16996 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 336 ms 17424 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 242 ms 13376 KB Output is correct
2 Incorrect 324 ms 16940 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 299 ms 17408 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 280 ms 13644 KB Output is correct
2 Incorrect 511 ms 19084 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 333 ms 19808 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 332 ms 16964 KB Output is correct
2 Incorrect 456 ms 23824 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 397 ms 24732 KB Output isn't correct
2 Halted 0 ms 0 KB -