Spring Coding Bowl '22 P2 - Chicken Strips

View as PDF

Submit solution


Points: 5 (partial)
Time limit: 0.5s
Memory limit: 64M

Author:
Problem types

Colin loves chicken strips. After searching far and wide, he has finally found the great chicken strip shrine!

The great chicken strip shrine contains a sorted line of infinite chicken strips where each chicken strip has a unique integer attached to it. To have a meal, Colin will choose to eat all the chicken strips in the range [l,r]. For example, if Colin was to eat all the chicken strips in the range [3,5], he would be eating chicken strips [3,2,1,0,1,2,3,4,5].

However, due to someone being a bit too hungry, the chicken strips between the range [d,u] no longer exist. For example, if Colin was to eat the chicken strips in the range [3,5] but the chicken strips in the range [1,4] no longer exist, Colin would be eating chicken strips [3,2,5].

The taste score of the meal is the product of the numbers of all the remaining chicken strips in the range [l,r]. For example, if the remaining chicken strips were [3,2,5], the taste score would be 3×2×5=30.

Colin would like to know if the taste score of the meal is positive, negative, zero, or nonexistent. Please help build him a program to do this!

Constraints

For all subtasks:

1018lr1018

1018du1018

Subtask 1 [20%]

10lr10

10du10

Subtask 2 [80%]

No additional constraints.

Input Specification

The first line of input will contain space-separated integers l and r, the lower and upper bound of the range of chicken strip values Colin would like to eat, respectively.

The next line of input will contain space-separated integers d and u, the lower and upper bound of the range of chicken strips that no longer exist, respectively.

Output Specification

Let x be the taste score of Colin's meal:

If x>0, print CHICKEN STRIP!!!. If x=0, print 0. If x<0, print -1. If x does not exist, print burnt chicken nugget.

Sample Input 1

Copy
1 5
2 4

Sample Output 1

Copy
CHICKEN STRIP!!!

Explanation for Sample 1

The chicken strips in the range [1,5] are [1,2,3,4,5]. If we exclude the chicken strips from [2,4], we get [1,5]. The product of the leftover chicken strips is 5 which is positive. Thus, print CHICKEN STRIP!!!.

Sample Input 2

Copy
-9 1
-6 0

Sample Output 2

Copy
-1

Explanation for Sample 2

The chicken strips in the range [9,1] are [9,8,7,6,5,4,3,2,1,0,1]. If we exclude the chicken strips from [6,0], we get [9,8,7,1]. The product of the leftover chicken strips is 504 which is negative. Thus, print -1.

Sample Input 3

Copy
-2 2
-2 2

Sample Output 3

Copy
burnt chicken nugget

Explanation for Sample 3

The chicken strips in the range [2,2] are [2,1,0,1,2]. If we exclude the chicken strips from [2,2], we get []. The product of the leftover chicken strips does not exist because there are no leftover chicken strips. Thus, print burnt chicken nugget.


Comments

There are no comments at the moment.