답안 #1109854

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1109854 2024-11-07T20:12:01 Z vjudge1 Mobile (BOI12_mobile) C++17
100 / 100
988 ms 27436 KB
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
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-4 < 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 << fixed << setprecision(4) << high << endl;
  return 0;
}
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 336 KB Output is correct
2 Correct 3 ms 336 KB Output is correct
3 Correct 3 ms 508 KB Output is correct
4 Correct 3 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 336 KB Output is correct
2 Correct 6 ms 336 KB Output is correct
3 Correct 4 ms 508 KB Output is correct
4 Correct 4 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 336 KB Output is correct
2 Correct 5 ms 336 KB Output is correct
3 Correct 4 ms 336 KB Output is correct
4 Correct 4 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 336 KB Output is correct
2 Correct 5 ms 336 KB Output is correct
3 Correct 4 ms 336 KB Output is correct
4 Correct 4 ms 336 KB Output is correct
5 Correct 5 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 56 ms 1012 KB Output is correct
2 Correct 69 ms 848 KB Output is correct
3 Correct 43 ms 848 KB Output is correct
4 Correct 45 ms 1028 KB Output is correct
5 Correct 30 ms 592 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 46 ms 1036 KB Output is correct
2 Correct 41 ms 980 KB Output is correct
3 Correct 47 ms 1068 KB Output is correct
4 Correct 48 ms 1044 KB Output is correct
5 Correct 53 ms 1104 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 77 ms 1112 KB Output is correct
2 Correct 74 ms 1076 KB Output is correct
3 Correct 66 ms 1088 KB Output is correct
4 Correct 71 ms 1208 KB Output is correct
5 Correct 53 ms 1124 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 94 ms 1104 KB Output is correct
2 Correct 90 ms 1104 KB Output is correct
3 Correct 75 ms 1220 KB Output is correct
4 Correct 66 ms 1104 KB Output is correct
5 Correct 60 ms 1360 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 93 ms 1104 KB Output is correct
2 Correct 90 ms 1212 KB Output is correct
3 Correct 73 ms 1212 KB Output is correct
4 Correct 62 ms 1104 KB Output is correct
5 Correct 71 ms 1104 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 401 ms 4344 KB Output is correct
2 Correct 455 ms 4344 KB Output is correct
3 Correct 540 ms 4344 KB Output is correct
4 Correct 307 ms 4176 KB Output is correct
5 Correct 344 ms 4340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 479 ms 4340 KB Output is correct
2 Correct 398 ms 4424 KB Output is correct
3 Correct 378 ms 4176 KB Output is correct
4 Correct 292 ms 4344 KB Output is correct
5 Correct 290 ms 4348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 477 ms 4944 KB Output is correct
2 Correct 588 ms 5116 KB Output is correct
3 Correct 539 ms 5128 KB Output is correct
4 Correct 358 ms 4944 KB Output is correct
5 Correct 351 ms 4944 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 571 ms 5124 KB Output is correct
2 Correct 500 ms 5192 KB Output is correct
3 Correct 436 ms 5128 KB Output is correct
4 Correct 406 ms 4944 KB Output is correct
5 Correct 363 ms 5124 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 593 ms 5900 KB Output is correct
2 Correct 643 ms 5712 KB Output is correct
3 Correct 645 ms 5908 KB Output is correct
4 Correct 429 ms 5712 KB Output is correct
5 Correct 399 ms 5924 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 672 ms 5908 KB Output is correct
2 Correct 569 ms 5908 KB Output is correct
3 Correct 590 ms 5912 KB Output is correct
4 Correct 421 ms 5904 KB Output is correct
5 Correct 424 ms 5712 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 619 ms 6480 KB Output is correct
2 Correct 786 ms 6480 KB Output is correct
3 Correct 716 ms 6688 KB Output is correct
4 Correct 500 ms 22420 KB Output is correct
5 Correct 497 ms 17736 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 765 ms 6736 KB Output is correct
2 Correct 636 ms 6688 KB Output is correct
3 Correct 601 ms 6684 KB Output is correct
4 Correct 490 ms 6692 KB Output is correct
5 Correct 479 ms 6696 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 774 ms 8016 KB Output is correct
2 Correct 988 ms 8252 KB Output is correct
3 Correct 942 ms 8252 KB Output is correct
4 Correct 636 ms 8256 KB Output is correct
5 Correct 563 ms 8016 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 969 ms 8260 KB Output is correct
2 Correct 810 ms 21460 KB Output is correct
3 Correct 808 ms 20532 KB Output is correct
4 Correct 666 ms 27436 KB Output is correct
5 Correct 616 ms 22956 KB Output is correct