시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 128 MB | 33 | 30 | 27 | 90.000% |
One night, while camping out in the wide open spaces, Big Ed was looking at the stars. Now Ed never bothered to learn his constellations, but decided that grouping the stars was a reasonable thing to do after all. But Big Ed was going to do it in a sensible manner. He decided on the following simple rules:
For example, if the picture of the sky looked like the following:
Then there are 3 constellations: {1, 2, 3, 4, 5}, {6, 7, 8}, {9, 10}.
Input will consist of a sequence of sky descriptions. Each begins with a single integer n: 0 < n ≤ 500 on a line, indicating the number of stars in the universe. The coordinates for the n stars follow as a pair x,y: 0 ≤ x ≤ 1000. A value of n = 0 indicates end of input.
For each sky description, print a single line of the form
Sky s contains c constellations.
where s is the number of the sky description (starting at 1) and c is the number of constellations.
10 0 1 16 3 1 0 2 7 9 0 4 1 2 2 8 1 9 3 15 5 5 10 10 10 11 20 10 20 11 15 5 0
Sky 1 contains 3 constellations. Sky 2 contains 1 constellations.