Submission #3792210


Source Code Expand

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

function purchase(a,b,c,d)
	now = a
	set = Int[]
	while 0==0
		k = div(now-c,b)
		if now-b*k == c
			push!(set,c)
			now = now-b*k+d
		else
			now = now-b*(k+1)
			if now < 0
				println("No")
				break
			end
			if now in set
				println("Yes")
				break
			end
			push!(set,now)
			now += d
		end
	end
end

function main()
	t = readline() |> parseInt
	for i in 1:t
		a,b,c,d = readline() |> split |> parseMap
		purchase(a,b,c,d)
	end
end

main()

Submission Info

Submission Time
Task B - rng_10s
User T49E2
Language Julia (0.5.0)
Score 0
Code Size 570 Byte
Status TLE
Exec Time 2114 ms
Memory 711188 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 600
Status
TLE × 2
TLE × 5
Set Name Test Cases
Sample example_0, example_1
All example_0, example_1, multi_0, multi_1, multi_2
Case Name Status Exec Time Memory
example_0 TLE 2114 ms 711188 KB
example_1 TLE 2114 ms 710116 KB
multi_0 TLE 2112 ms 110976 KB
multi_1 TLE 2112 ms 110720 KB
multi_2 TLE 2112 ms 111004 KB