Submission #1109852

# Submission time Handle Problem Language Result Execution time Memory
1109852 2024-11-07T20:08:15 Z vjudge1 Mobile (BOI12_mobile) C++17
8 / 100
998 ms 8252 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 - 1.0 * 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 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 336 KB Output is correct
2 Correct 3 ms 336 KB Output is correct
3 Correct 2 ms 336 KB Output is correct
4 Incorrect 5 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 4 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 5 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 59 ms 848 KB Output is correct
2 Incorrect 75 ms 1024 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 46 ms 1044 KB Output is correct
2 Correct 46 ms 848 KB Output is correct
3 Incorrect 49 ms 1064 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 73 ms 1104 KB Output is correct
2 Incorrect 79 ms 848 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 105 ms 1104 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 101 ms 1104 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 415 ms 4340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 527 ms 4344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 488 ms 5192 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 614 ms 4944 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 599 ms 5908 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 694 ms 5908 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 656 ms 6480 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 823 ms 6684 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 845 ms 8016 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 998 ms 8252 KB Output isn't correct
2 Halted 0 ms 0 KB -