\(B=5-x^2+2x-4y^2-4y\)
\(\Leftrightarrow B=7-1-1-x^2+2x-4y^2-4y\)
\(\Leftrightarrow B=-\left(x^2-2x+1\right)-\left(4y^2+4y+1\right)+7\)
\(\Leftrightarrow B=-\left(x-1\right)^2-\left(2y+1\right)^2+7\)
Vậy GTLN của \(B=7\) khi \(\left\{{}\begin{matrix}x-1=0\Leftrightarrow x=1\\2y+1=0\Leftrightarrow y=\dfrac{-1}{2}\end{matrix}\right.\)