Brock Purdy threw for 225 yards and two touchdowns, Deebo Samuel caught six passes for 87 yards, and the San Francisco 49ers topped the Seattle Seahawks 20-17.