Submission #1109851

# Submission time Handle Problem Language Result Execution time Memory
1109851 2024-11-07T20:06:57 Z vjudge1 Mobile (BOI12_mobile) C++17
8 / 100
1000 ms 24496 KB
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

int main() {
  int N, L;
  cin >> N >> L;
  vector<pair<int, int>> tr(N);
  for (auto& p : tr) cin >> p.first >> p.second;

  double low = 0, high = 3 * 1e9;
  while (low + 1e-5 < high) {
    double r = (high + low) / 2;
    vector<pair<double, double>> s;
    for (auto& p : tr) {
      if (abs(p.second) >= r) continue;
      double x = sqrt(r* r - p.second * p.second);
      double x1 = p.first - x, x2 = p.first + x;

      // x2 >= s.back().first is always true. That's why we can use merge with stack.
      while (!s.empty() && s.back().second >= x1) {
        x1 = min(x1, s.back().first);
        x2 = max(x2, s.back().second);
        s.pop_back();
      }
      s.push_back({x1, x2});
    }

    bool ok = false;
    for (auto& p : s) {
      if (p.first <= 0 && p.second >= L) {
        ok = true;
      }
    }
    if (ok) {
      high = r;
    } else {
      low = r;
    }
  }
  cout << high << endl;
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 2 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 336 KB Output is correct
2 Correct 3 ms 512 KB Output is correct
3 Correct 2 ms 336 KB Output is correct
4 Incorrect 3 ms 336 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 336 KB Output is correct
2 Incorrect 6 ms 336 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 336 KB Output is correct
2 Incorrect 7 ms 336 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 592 KB Output is correct
2 Incorrect 6 ms 336 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 59 ms 1824 KB Output is correct
2 Incorrect 72 ms 1916 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 48 ms 1628 KB Output is correct
2 Correct 45 ms 1616 KB Output is correct
3 Incorrect 52 ms 2084 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 81 ms 1616 KB Output is correct
2 Incorrect 81 ms 2096 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 104 ms 2632 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 118 ms 2732 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 446 ms 8628 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 529 ms 12360 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 500 ms 10104 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 616 ms 14920 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 613 ms 11900 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 718 ms 17420 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 682 ms 13612 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 831 ms 19872 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 900 ms 16816 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1063 ms 24496 KB Time limit exceeded
2 Halted 0 ms 0 KB -