Editorial for Spring Coding Bowl '22 P2 - Chicken Strips
Submitting an official solution before solving the problem yourself is a bannable offence.
To rephrase the question more directly, we want to know if the product of the integers in the range  excluding the integers in the range 
 is positive, negative, zero, or nonexistent.
Subtask 1
For this subtask, loop from  to 
 and for each number, check if it is in the range 
. If it is, ignore it. Otherwise, add it to an array. Once you are done, get the product of numbers in the array and print the proper output accordingly. Be sure to check that there are numbers in the array to avoid outputting a wrong answer.
Time Complexity: 
Subtask 2
For this subtask, we can think of the results as cases to handle. The product doesn't exist if  and 
. The product is 
 if and only if 
 is in the range 
 and is not in the range 
. Assuming the product exists and is non-zero, the only way the product could be negative is if there are an odd number of negative numbers in the range 
 excluding those in the range 
. All other cases result in a positive product.
Thus, the problem can be distilled down to some careful casework and counting the number of negative numbers in the range  excluding those in the range 
. There are many different ways of doing this, all of which can be done with if-statements and basic arithmetic. Specific implementation details will be left as an exercise to the reader.
Time Complexity: 
Comments