Submission #967262

# Submission time Handle Problem Language Result Execution time Memory
967262 2024-04-21T16:30:50 Z v_matei Mobile (BOI12_mobile) C++17
0 / 100
1000 ms 48436 KB
#include <bits/stdc++.h>
#include <cmath>
#include <iomanip>

#define ll long long
#define ull unsigned long long
#define pdd std::pair<double, double>

#define NMAX 1e6
#define LMAX 1e9
#define INF 3e9

struct Tower {
  double x, y;
};
struct Seg {
  double st, fn;
};
double n, l;
std::vector<Tower> s;

void citire() {
  std::cin >> n >> l;
  s.resize(n);
  for (int i = 0; i < n; i++) {
    std::cin >> s[i].x >> s[i].y;
  }
}

double b_search(double lo, double hi, std::function<bool(double)> f) {
  // std::cout << "a\n";
  for (int i = 1; hi - lo > 0.001; i++) {
    double mid = (lo + hi) / 2;
    if (f(mid))
      hi = mid;
    else
      lo = mid;
  }
  return lo;
}

bool find_point(double k) {
  std::vector<Seg> segs;
  for (Tower &it : s) {
    if (k * k < it.y * it.y)
      continue;
    double max_dx = sqrt(k * k - it.y * it.y);
    segs.push_back({it.x - max_dx, it.x + max_dx});
  }
  Seg curr_inter = {-INF, INF};
  for (Seg &it : segs) {
    if (it.fn < curr_inter.st || it.st > curr_inter.fn)
      return 0;
    if (it.st > curr_inter.fn)
      return 0;
    if (it.st >= curr_inter.st) {
      curr_inter.st = it.st;
    }
    if (it.fn <= curr_inter.fn) {
      curr_inter.fn = it.fn;
    }
  }
  return 1;
}

int main() {
  citire();
  // std::cout << "out\n";
  double k = b_search(0, INF, find_point);
  std::cout << std::setprecision(10) << k;
  return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 728 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 728 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 732 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 113 ms 4960 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 114 ms 5068 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 122 ms 5352 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 155 ms 5676 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 170 ms 5720 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 673 ms 24320 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 744 ms 24324 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 839 ms 36828 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 934 ms 36184 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 957 ms 39440 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1047 ms 39192 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1014 ms 42288 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1069 ms 43004 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1053 ms 48172 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1068 ms 48436 KB Time limit exceeded
2 Halted 0 ms 0 KB -