QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#105034#5505. Great ChasekingstonduyRE 0ms0kbPython3735b2023-05-12 21:00:012023-05-12 21:00:24

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-12 21:00:24]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2023-05-12 21:00:01]
  • 提交

answer

tc= int(input())
while(tc != 0):
    tc-=1
    sc= float(input.split())
    n= sc[0]
    v= sc[1]
    a=[]
    for i in range (n):
        sc= float(input.split())
        a.append((sc[0],sc[1]))
    l=0
    r=1e12
    res=0
    e= 1e-10
    while(l<=r and l+e < r):
        mid= (l+r)/2
        ls= -1e18
        rs= 1e18
        for i in range (n):
            temp1, temp2= a[i]
            dis= temp2 * mid
            if(temp1 < 0):
                ls=max(ls, temp1 + dis)
            else:
                rs= min(rs, temp1 - dis)
        if(ls <= rs):
            res= max(res, mid)
            l= mid+e
        else:
            r= mid-e
    output = "{:.10f}".format(res * v)
    print(output)

详细

Test #1:

score: 0
Runtime Error

input:

3
4 9
10 2
-7 2
-6 1
7 1
2 8
-1 7
1 6
2 3
-1000000000000 1
1000000000000 1

output:


result: