Submission #7011812


Source Code Expand

parseInt(x::SubString{String}) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = parseInt.(x)

function main()
	n,hp = readline() |> split |> parseMap
	x = Array{Int}(2,n)
	maxa = 0
	for i in 1:n
		x[:,i] = readline() |> split |> parseMap
		maxa = max(maxa,x[1,i])
	end
	useb = Int[]
	for i in 1:n
		if x[2,i] > maxa
			push!(useb, x[2,i])
		end
	end
	useb = sort(useb, rev=true)
	count = 0
	for i in 1:length(useb)
		if hp > 0
			hp -= useb[i]
			count += 1
		end
	end
	if hp > 0
		if hp%maxa == 0
			count += div(hp, maxa)
		else
			count += div(hp, maxa)+1
		end
	end
	print(count)
end

main()

Submission Info

Submission Time
Task D - Katana Thrower
User T49E2
Language Julia (0.5.0)
Score 400
Code Size 639 Byte
Status AC
Exec Time 1079 ms
Memory 175956 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 4
AC × 24
Set Name Test Cases
Sample a01, a02, a03, a04
All a01, a02, a03, a04, b05, b06, b07, b08, b09, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24
Case Name Status Exec Time Memory
a01 AC 1079 ms 175956 KB
a02 AC 535 ms 116560 KB
a03 AC 541 ms 115940 KB
a04 AC 536 ms 116060 KB
b05 AC 537 ms 115116 KB
b06 AC 720 ms 153004 KB
b07 AC 540 ms 116628 KB
b08 AC 720 ms 153660 KB
b09 AC 537 ms 115784 KB
b10 AC 548 ms 117180 KB
b11 AC 536 ms 116480 KB
b12 AC 537 ms 117052 KB
b13 AC 671 ms 156040 KB
b14 AC 675 ms 155576 KB
b15 AC 670 ms 154492 KB
b16 AC 669 ms 152692 KB
b17 AC 684 ms 154396 KB
b18 AC 680 ms 152700 KB
b19 AC 676 ms 153296 KB
b20 AC 673 ms 153728 KB
b21 AC 686 ms 156416 KB
b22 AC 693 ms 156672 KB
b23 AC 533 ms 117632 KB
b24 AC 535 ms 116400 KB