QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#221044#5593. Food Processorwaddehaddeduddeda2TL 265ms32708kbPython31.1kb2023-10-21 02:48:412023-10-21 02:48:41

Judging History

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

  • [2023-10-21 02:48:41]
  • 评测
  • 测评结果:TL
  • 用时:265ms
  • 内存:32708kb
  • [2023-10-21 02:48:41]
  • 提交

answer

import math

class blade():
   def __init__(self, max_, speed):
        self.max_ = max_
        self.speed = speed

arr_1 = [int(i) for i in  input().split()]
s,t,n = arr_1[0],arr_1[1],arr_1[2]

blades = []
blades.append(blade(0,0))


for i in range(0,n):
    arr_2 = [int(i) for i in  input().split()]
    blade_ = blade(arr_2[0],arr_2[1])
    blades.append(blade_)


blades.sort(key=lambda x: (x.max_))


    

if(blades[len(blades)-1].max_ < s):
    print(-1)
else:
    time = 0
    c_b_i = len(blades)-1
    cb = blades[c_b_i]
    while(abs(s-t)>10**(-5)):
        # haben wir das opt. blade für größre
        i = 1

        
        while(blades[c_b_i-i].max_ >= s):
            if(blades[c_b_i-i].speed < cb.speed):
                c_b_i = c_b_i-i   
                cb = blades[c_b_i]
                break
            i += 1
        #bis nächsten blade schneiden
        t_1 = max(blades[c_b_i-i].max_,t)
        time += (math.log(t_1)-math.log(s))*cb.speed/math.log(1/2)
        s = t_1
       
    print(time)    
            
        

詳細信息

Test #1:

score: 100
Accepted
time: 15ms
memory: 9120kb

input:

10 1 2
10 10
4 5

output:

23.219280948873624

result:

ok found '23.21928', expected '23.21928', error '0.00000'

Test #2:

score: 0
Accepted
time: 15ms
memory: 9172kb

input:

10000 9999 1
10000 1

output:

0.00014427671804615675

result:

ok found '0.00014', expected '0.00014', error '0.00000'

Test #3:

score: 0
Accepted
time: 9ms
memory: 9184kb

input:

10 1 2
8 10
4 5

output:

-1

result:

ok found '-1.00000', expected '-1.00000', error '-0.00000'

Test #4:

score: 0
Accepted
time: 10ms
memory: 9048kb

input:

8 2 1
8 10

output:

19.999999999999996

result:

ok found '20.00000', expected '20.00000', error '0.00000'

Test #5:

score: 0
Accepted
time: 265ms
memory: 32708kb

input:

1000000 1 100000
10 10
20 20
30 30
40 40
50 50
60 60
70 70
80 80
90 90
100 100
110 110
120 120
130 130
140 140
150 150
160 160
170 170
180 180
190 190
200 200
210 210
220 220
230 230
240 240
250 250
260 260
270 270
280 280
290 290
300 300
310 310
320 320
330 330
340 340
350 350
360 360
370 370
380 3...

output:

1442798.0508795823

result:

ok found '1442798.05088', expected '1442798.05088', error '0.00000'

Test #6:

score: -100
Time Limit Exceeded

input:

1000000 1 100000
1000000 10
999990 20
999980 30
999970 40
999960 50
999950 60
999940 70
999930 80
999920 90
999910 100
999900 110
999890 120
999880 130
999870 140
999860 150
999850 160
999840 170
999830 180
999820 190
999810 200
999800 210
999790 220
999780 230
999770 240
999760 250
999750 260
99974...

output:


result: