9 teams scored 515 points on this task, for a maximum score of 100, an average score of 57 and a median score of 35.
Giorgio has composed a new song… but he's not quite satisfied of the result, and plans to improve it. The song is a sequence of N musical notes and the i-th note has a pitch P_i, represented as an integer from 1 to N for simplicity. To improve the song with the lowest effort, Giorgio has decided to proceed by removing some of the musical notes in the original song. First of all, he knows that for every note pitch a, there is a complementary note pitch C_a. Let S_j be the pitch of the j-th musical note of the new song. He wants the final song to be such that, for every pair of consecutive notes j and j+1, either S_j < S_j+1 or S_j+1 = C_S_j. Of course, Giorgio would like to remove as little notes as possible, otherwise the new song could end up being too short. Help Giorgio find the length of the longest song he can make!