← 返回 snapchat 的题目列表Determine Whether Three Cards Form a Valid Set (SET Game Variant)
类型:online_judge
In a card game variant of SET, each card has F=4 features. Each feature value is in {1,2,3}, so a card can be represented as a length-4 tuple such as (1,1,2,2).
Given three cards A, B, C, determine whether they form a valid set.
For every feature dimension i (0..3), the three values at that dimension must satisfy either:
all the same, or
all different.
If any dimension is neither all-same nor all-different, the three cards do not form a valid set.
Output true or false.
Input (stdin)
3 lines, each line has 4 integers in {1,2,3}, representing A, B, C.
Output (stdout)
One line: true or false.
Example (valid)
Input:
1 1 2 2
2 3 1 1
3 2 3 3
Output:
true
Example
Input
1 1 2 2
2 3 1 1
3 2 3 3
Output
true