CMIMC 2017 Computer Science Problem 7

You are presented with a mystery function f: \mathbb{N}^{2} \rightarrow \mathbb{N} which is known to satisfy

f(x+1, y)>f(x, y) \quad \text { and } \quad f(x, y+1)>f(x, y)

for all (x, y) \in \mathbb{N}^{2}. I will tell you the value of f(x, y) for \$ 1. What’s the minimum cost, in dollars, that it takes to compute the 19th smallest element of \{f(x, y) \mid(x, y) \in \mathbb{N}^{2}\}? Here, \mathbb{N}=\{1,2,3, \ldots\} denotes the set of positive integers.