\(P-\dfrac{5}{2}=x+2y-\dfrac{x^2+y^2}{2}=-\dfrac{1}{2}\left(x-1\right)^2-\dfrac{1}{2}\left(y-2\right)^2+\dfrac{5}{2}\le\dfrac{5}{2}\)
\(\Rightarrow P-\dfrac{5}{2}\le\dfrac{5}{2}\Rightarrow P\le5\)
\(P_{max}=5\) khi \(\left(x;y\right)=\left(1;2\right)\)