Solve the equation $f(x+y)=\max(f(x),y)+\min(x,f(y))$ 
Solve the equation $$f(x+y)=\max(f(x),y)+\min(x,f(y))$$

My work so far:
1) $y=0 $
$f(x)=\max(f(x),0)+\min (x,f(0))$
2) $y=-x$
$f(0)=\max(f(x),-x)+\min(x,f(-x))$
 A: If you put $y=x$ you get
$$f(2x) = \max (f(x),x) + \min (f(x),x) = f(x)+x$$
because if one of them is the maximum the other one is the minimum.
Let $g(x)=f(x)-x$ then $g(2x)+2x = g(x)+x+x$ hence $g(2x)=g(x)$ and so (assuming that $f$ is continuous) $g(x)$ is a constant, say $g(x)=c$ for some $c\in\mathbb{R}$.
It follows that $f(x)=x+c$. Now we check for which $c$ we have a solution, we need that
$f(x+y) = x+y+c = \max (x+c,y) + \min(x,y+c)$
clearly we can find $x,y$ such that $\max (x+c,y)=x+c$ and $\min(x,y+c)=y+c$ so we get that
$$x+y+c = x+c+y+c$$ it follows that $c=0$. We conclude that $f(x)=x$ is the only (continuous) solution.
Edit: Without the continuity we can argue as follows: Observe that $$f(x+y) = \max (f(x),y) + \min (x,f(y))$$
$$f(y+x) = \max (f(y),x) + \min (y,f(x))$$
If we add these equations we get:
$$2f(x+y) = f(x)+f(y)+x+y$$
Now let $g(x)=f(x)-x$ we have $$2g(x+y)+2x+2y = g(x)+x+g(y)+y+x+y$$ and so $$2g(x+y) = g(x)+g(y)$$
Let $y=0$ we have that $2g(x) = g(x)+g(0)$ therefore $g(x)=g(0)$, we conclude that $g(x)$ is a constant.
A: Since $$\max \{a,b\} = {a+b+|a-b|\over 2}\;\;\;\;{\rm and }\;\;\;\;\min \{a,b\} = {a+b-|a-b|\over 2}$$
we get
$$ \boxed{2f(x+y) = f(x)+y+|f(x)-y|+x+f(y)-|x-f(y)|}$$
Let $c=f(0)$. For $y=0, x=t$: 
$$ f(t) = |f(t)|+t+c-|t|$$
and for $x=0,y=t$:
$$f(t) =c+t+|c-t| -|f(t)|$$
Adding last two we get: $f(t) = t+c$, for all $t$.
Plugging this in boxed equation we get $$|x-y+c| = |x-y-c|$$
which is valid for all $x,y$, so also for $x=c$ and $y=0$ and so $c=0$. Thus the only solution is $f(x)=x$.
