Submission #492207

#TimeUsernameProblemLanguageResultExecution timeMemory
492207ntarsisMobile (BOI12_mobile)Pypy 3
25 / 100
1095 ms131076 KiB
from math import sqrt import sys n,l = map(int,input().split()) nums = [] for i in range(n): a,b = sys.stdin.readline().split() a = int(a) b = int(b) nums.append([a,b]) lo = 0 ans = 80000000 hi = 80000000 def merge(intervals): ans = [] for i in intervals: if not ans or ans[-1][1] < i[0]: ans.append(i) if len(ans)>1: return ans else: if ans[-1][1] < i[1]: ans[-1][1]=i[1] return ans def check(x): intervals = [] for i in nums: a,b = i[0],i[1] bruh = x*x-b*b if bruh>=0: c = sqrt(bruh) part1 = a-c part2 = a+c if bruh>=0 and part2>=0 and part1<l: intervals.append([part1,part2]) intervals.sort() b = merge(intervals) return len(b)==1 and b[0][0]<=0 and b[0][1]>=l while hi - lo > 10**-(3.3): mid = (hi+lo)/2 if check(mid): ans = mid hi = mid else: lo = mid print(ans)
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...