For someone getting every answer wrong there are 2 options for each of the 18 questions so there are 2^{18}ways of answering all wrong.

In total there are 3^{18}ways of answering, only 1 of those is getting all questions correct so the number of ways they can get not all correct is 3^{18}-1