Submission #835847

# Submission time Handle Problem Language Result Execution time Memory
835847 2023-08-23T21:12:38 Z iamjiamingliu Mobile (BOI12_mobile) Python 3
0 / 100
1000 ms 131072 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 not math.isclose(l, r):
    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 11 ms 2772 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 18 ms 2900 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 63 ms 3156 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 96 ms 3504 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 85 ms 3540 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 84 ms 3376 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1077 ms 13060 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1036 ms 13180 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1060 ms 12004 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1047 ms 16412 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1043 ms 16488 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1063 ms 54576 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1035 ms 70496 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1053 ms 64836 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1044 ms 84020 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1055 ms 75188 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1051 ms 97528 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1064 ms 85548 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1058 ms 110924 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1039 ms 106128 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 892 ms 131072 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -