QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#105038#5505. Great ChasekingstonduyWA 8ms8072kbPython3731b2023-05-12 21:06:302023-05-12 21:06:35

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:06:35]
  • 评测
  • 测评结果:WA
  • 用时:8ms
  • 内存:8072kb
  • [2023-05-12 21:06:30]
  • 提交

answer

tc= int(input())
while(tc != 0):
    tc-=1
    n,v= map(float, input().split())
    a=[]
    for i in range (int(n)):
        pi, vi = map(float, input().split())
        a.append((pi, vi))
    l=0
    r=1e12
    res=0
    e= 1e-8
    while(l<=r and l+e < r):
        mid= (l+r)/2
        ls= -1e18
        rs= 1e18
        for i in range (int(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
Wrong Answer
time: 8ms
memory: 8072kb

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:

38.2499997572
1.2307690958
3000000000000.0000000000

result:

wrong answer 2nd numbers differ - expected: '1.2307692', found: '1.2307691', error = '0.0000001'