Back
Close

Rings and Groups

Statement
In algebra, a GROUP is a set in which you can perform one operation (for this problem, either addition or multiplication mod N) on any two members of the set, and the result is also in the set. There is also an identity requirement, so additive groups must contain a 0, and multiplicative groups a 1. A RING is a group under both addition and multiplication. Classify each set as a GROUP+, GROUP*, RING, or NONE.

Input description
<<Line 1:>> The modulus [[N]] <<Line 2:>> The [[SetSize]] <<Line 3:>> Space-separated integer values that make up the set

Output description
One line classifying the set.

Constraints
[[N]] ≤ 50 [[SetSize]] ≤ 50 0≤ set values ≤ 50

Game modes
Fastest

Test cases
Test 1 Test
Input
12 6 0 2 4 6 8 10
Output
GROUP+

Validator 1 Validator
Input
7 6 1 2 3 4 5 6
Output
GROUP*

Test 2 Test
Input
11 10 1 2 3 4 5 6 7 8 9 10
Output
GROUP*

Validator 2 Validator
Input
22 11 0 2 4 6 8 10 12 14 16 18 20
Output
GROUP+

Test 3 Test
Input
35 32 0 1 2 4 5 6 7 8 9 10 11 12 13 14 15 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 33 34
Output
NONE

Validator 3 Validator
Input
35 32 0 1 2 3 4 5 6 7 8 9 10 11 12 14 15 16 17 18 19 20 22 23 24 25 26 27 29 30 31 32 33 34
Output
NONE

Test 4 Test
Input
25 25 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
Output
RING

Validator 4 Validator
Input
30 30 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
Output
RING

Test 5 Test
Input
50 49 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
Output
NONE

Validator 5 Validator
Input
50 49 0 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
Output
NONE

Solution language

Solution

Stub generator input