Algorithm
problem Link : https://www.codechef.com/problems/CHEFGAMES
Problem
In Chefland, a tennis game involves referees.
Each referee has to point out whether he considers the ball to be inside limits or outside limits. The ball is considered to be IN
if and only if all the referees agree that it was inside limits.
Given the decision of the referees, help Chef determine whether the ball is considered inside limits or not.
Input Format
- The first line of input will contain a single integer , denoting the number of test cases.
- Each test case consists of a single line of input containing integers denoting the decision of the respective referees.
Here can be either or where would denote that the referee considered the ball to be inside limits whereas denotes that they consider it to be outside limits.
Output Format
For each test case, output IN
if the ball is considered to be inside limits by all referees and OUT
otherwise.
The checker is case-insensitive so answers like in
, In
, and IN
would be considered the same.
Constraints
Sample 1:
4 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 1
OUT IN OUT OUT
Explanation:
Test case : Referees and do not consider the ball to be IN
. Thus, the ball is OUT
.
Test case : All referees consider the ball to be IN
. Thus, the ball is IN
.
Test case : Referee does not consider the ball to be IN
. Thus, the ball is OUT
.
Test case : No referee considers the ball to be IN
. Thus, the ball is OUT
.
Code Examples
AdvertisementsDemonstration
CodeChef solution CHEFGAMES - Chefland Games Codechef solution in C,C++