North Korean leader Kim Jong Un and Chinese President Xi Jinping have agreed to deepen political and economic ties during a rare state visit to Beijing, North Korean state media says.