CMIMC 2022 Combinatorics and Computer Science Problem 7

In a class of 12 students, no two people are the same height. Compute the total number of ways for the students to arrange themselves in a line such that:

1. for all 1<i<12, the person in the i-th position (with the leftmost position being 1 ) is taller than exactly i(\bmod 3) of their adjacent neighbors, and
2. the students standing at positions which are multiples of 3 are strictly increasing in height from left to right.