Editorial for COCI '07 Contest 6 #3 Granica
Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
Submitting an official solution before solving the problem yourself is a bannable offence.
For of the score an easy brute force solution was available, trying every between and and checking whether all given integers give the same remainder when divided by .
For the full score, we need the following deduction: if some two numbers and give the same remainder when divided by , then divides . So for an integer to be part of the output, it must divide the differences between each pair of input numbers. The largest such is the greatest common divisor of the differences between input numbers. The remaining values of are all divisors of the largest (except for ).
Comments