Submission #835852

# Submission time Handle Problem Language Result Execution time Memory
835852 2023-08-23T21:15:38 Z iamjiamingliu Mobile (BOI12_mobile) PyPy 3
0 / 100
1000 ms 115000 KB
import sys
import math

towers_cnt, line_len = map(int, sys.stdin.readline().strip().split())
towers = [tuple(map(int, sys.stdin.readline().strip().split())) for _ in range(towers_cnt)]

def can_cover_whole_line(radius: float) -> bool:
    curr = 0
    for x, y in towers:
        delta = math.sqrt(radius ** 2 - y ** 2)
        a, b = x - delta, x + delta
        if a <= curr:   curr = max(curr, b)
    return curr >= line_len
    # total_dist = 0
    # for x, height in towers:
    #     if height > radius:     continue
    #     dist = math.sqrt(radius ** 2 - height ** 2)
    #     if x - dist <= total_dist <= x + dist:
    #         total_dist = x + dist
    # return total_dist >= line_len

l, r = 0, 1.5e9
while r - l > 1e-3:
    mid = (l + r) / 2
    if can_cover_whole_line(radius=mid):
        r = mid
    else:
        l = mid

print(l)
# Verdict Execution time Memory Grader output
1 Runtime error 50 ms 20100 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 62 ms 20520 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 61 ms 21896 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 67 ms 21792 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 67 ms 21784 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 69 ms 21612 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 112 ms 27708 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 116 ms 28016 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 101 ms 27696 KB Output is correct
2 Correct 128 ms 27596 KB Output is correct
3 Runtime error 104 ms 28452 KB Execution failed because the return code was nonzero
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 148 ms 28664 KB Output is correct
2 Correct 136 ms 29736 KB Output is correct
3 Runtime error 118 ms 30192 KB Execution failed because the return code was nonzero
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 130 ms 29176 KB Output is correct
2 Correct 135 ms 29792 KB Output is correct
3 Runtime error 115 ms 30124 KB Execution failed because the return code was nonzero
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 451 ms 67268 KB Output is correct
2 Correct 522 ms 67676 KB Output is correct
3 Correct 513 ms 67620 KB Output is correct
4 Runtime error 402 ms 68924 KB Execution failed because the return code was nonzero
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 542 ms 67624 KB Output is correct
2 Runtime error 430 ms 68428 KB Execution failed because the return code was nonzero
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 591 ms 75852 KB Output is correct
2 Correct 623 ms 76724 KB Output is correct
3 Correct 628 ms 76872 KB Output is correct
4 Runtime error 436 ms 77612 KB Execution failed because the return code was nonzero
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 639 ms 76820 KB Output is correct
2 Runtime error 489 ms 77516 KB Execution failed because the return code was nonzero
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 631 ms 86944 KB Output is correct
2 Correct 751 ms 86892 KB Output is correct
3 Correct 734 ms 87312 KB Output is correct
4 Runtime error 499 ms 88096 KB Execution failed because the return code was nonzero
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 743 ms 87364 KB Output is correct
2 Runtime error 586 ms 88188 KB Execution failed because the return code was nonzero
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 698 ms 95088 KB Output is correct
2 Correct 855 ms 96068 KB Output is correct
3 Runtime error 556 ms 96836 KB Execution failed because the return code was nonzero
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 832 ms 95908 KB Output is correct
2 Runtime error 653 ms 96836 KB Execution failed because the return code was nonzero
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 855 ms 113928 KB Output is correct
2 Execution timed out 1073 ms 115000 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1042 ms 114704 KB Time limit exceeded
2 Halted 0 ms 0 KB -