Woburn Challenge 2018-19 Round 1 - Senior Division
students are filing into H.S. High School's popular French class, one after another. The classroom has a whopping desks, all arranged in a single row and numbered from left to right. The -th student to arrive has a social standing of , and will sit at desk . All students have distinct social standings and will sit at distinct desks.
Even though the students love learning French, they sometimes still get distracted by their phones and stop paying attention in class. Furthermore, this issue is exasperated by the effects of peer pressure! If the -th student were to start using their phone, all students with smaller social standings who are sitting no further than desks away from the -th student will also start doing so in other words, each student such that and . As a result of those students using their phones, even more students may in turn start using their phones, and so on.
When one or more students are present in the classroom, the "volatility" of that set of students is defined as the minimum number of students who would need to initially start using their phones by themselves, such that all of the students currently present would end up using their phones.
As the students file in, the French teacher wants to keep track of the volatility of her class, to give her an idea of what she'll be in for. So, after each student sits down, the teacher is interested in the volatility of the students present so far students . Please help her compute this list of volatilities.
Subtasks
In test cases worth 8/40 of the points, .
In test cases worth another 6/40 of the points, .
In test cases worth another 8/40 of the points, .
Input Specification
The first line of input consists of a single integer, .
lines follow, the -th of which consists of three space-separated
integers, , , and , for .
Output Specification
Output lines, the -th of which should consist of a single integer, the volatility after the first students have arrived, for .
Sample Input
8
14 5 1
8 6 3
12 1 3
19 8 2
21 7 3
10 11 1
3 10 6
13 9 10
Sample Output
1
1
2
3
2
3
3
1
Sample Explanation
After the first student arrives, it would be necessary for just them to start using their phone, resulting in a volatility of .
After the second student arrives, it would still only be necessary for student to start using their phone, as that would also cause student to also use their phone. Therefore, the volatility of these two students is still .
After the third student arrives, it would be necessary for at least two of the three students to start using their phones (students and ). Therefore, the volatility of these three students is .
Once all students are present, they would all end up using their phones if only student initially decided to use their phone. Therefore, the volatility of all students is .
Comments