Mavericks earn bid to state tournament