Hide

Problem A
Check Your Color Set

/problems/checkyourcolorset/file/statement/en/img-0001.jpg
A image of a color palette containing 12 different colors
Source: By G4sxe at the English Wikipedia

As a hobbyist graphic designer, spence often finds it fascinating to observe how colors interact while designing. Sometimes, the colors don’t complement each other, and determining when this happens can feel like guesswork. Fortunately, the graphics design community has a metric that allows spence to decide how far two colors are from each other, and this metric is called the color difference.

When designing posters, spence represents each color as a point in 3D space, where the red, green, and blue (RGB) components correspond to the $x$, $y$, and $z$ coordinates. To evaluate the contrast between two colors, spence computes the Euclidean distance between their respective points. A color difference of at least $128$ ensures that the colors provide enough visual differentiation.

Your task is to help spence develop a program to verify whether the colors in his poster designs meet the minimum contrast threshold for all pairs of colors.

Input

The input starts with a single integer $n$ ($1 \leq n \leq 100$), the number of poster designs (color sets). This is followed by $n$ descriptions of poster designs. For each poster design, the first line contains an integer $m$ ($2 \leq m \leq 20$), the number of colors used in the poster. The following $m$ lines each contain three integers $R$, $G$, and $B$ ($0 \leq R, G, B \leq 255$), representing the RGB values of a single color.

Output

The output should consist of $n$ boolean values, each on a new line. Each boolean indicates whether all color pairs in the corresponding poster meet the minimum contrast requirement. Output True if all pairs in the poster meet the threshold; otherwise, output False.

Sample Input 1 Sample Output 1
2
3
0 0 0
255 255 255
128 128 128
2
0 0 0
50 50 50
True
False

Please log in to submit a solution to this problem

Log in