\(P=-\left(x+5\right)^2-\left|x-y+1\right|+2019\)
+Có:\(-\left(x+5\right)^2\le0với\forall x\\ -\left|x-y+1\right|\le với\forall y\\ \Rightarrow-\left(x+5\right)^2-\left|x-y+1\right|+2019\le2019\\ \Leftrightarrow P\le2019\)
+Dấu "=" xảy ra khi
\(\left(x+5\right)^2=0\Leftrightarrow x=-5\)
\(\left|x-y+1\right|=0\Leftrightarrow y=-4\)
+Vậy \(P_{max}=2019\) khi \(x=-5,y=-4\)