Security officials gave conflicting accounts of the attack at the beachfront resort. Photographs posted to social media, purported to be from the scene, showed the bodies of two attackers, as well as a piece of black cloth that resembled an Islamic State flag.