#P8016. [COCI 2013/2014 #4] ČOKOLADE
[COCI 2013/2014 #4] ČOKOLADE
Problem Description
Mirko held parties, one each day. On the -th party, he invites people to each table.
Mirko prepared tables, and there are candies on the -th table.
After all invited people sit down, the people at the same table share the candies on that table equally. In other words, on day , at table , each person sitting at that table will get candies.
The number of candies is updated every day, and it does not decrease because of sharing.
Only tables where the candies per person are the same will socialize.
Now, for each positive integer from to , Mirko wants you to find the earliest day on which exactly tables socialize.
Input Format
The first line contains a positive integer , representing the number of parties.
The second line contains positive integers , where is the number of candies on the -th table.
Output Format
Output lines in total. Each line contains one integer. The -th line should be the earliest day on which exactly tables socialize. If there is no day on which exactly tables socialize, output -1.
5
11 10 9 6 4
1
2
3
6
12
3
5 5 5
-1
-1
1
8
12 16 95 96 138 56 205 84
1
5
14
49
96
97
139
206
Hint
Sample Explanation #1.
On the first day, no table will socialize with any other table.
On the second day, at tables and , everyone gets candies, so these two tables will socialize.
On the third day, at tables , , and , everyone gets candies, so these three tables will socialize.
On the sixth day, at tables , , , and , everyone gets candy, so these four tables will socialize.
On the twelfth day, at tables , , , , and , everyone gets candies, so these five tables will socialize.
Constraints.
For of the testdata, , .
Source.
The score of this problem follows the original COCI problem setting, with a full score of .
This problem is translated from COCI2013-2014 CONTEST #4 T5 ČOKOLADE.
Translated by ChatGPT 5