Editorial for IOI '98 P2 - Starry Night
Submitting an official solution before solving the problem yourself is a bannable offence.
Introduction to the Problem
Starry Night is a graphic pattern matching problem, algorithmically challenging, but allowing a natural gradation on the degree of completion of the solution.
The task description is easy to understand. Outlining a solution is also not too difficult.
However, due to the multiple orientations of the clusters and their irregular shapes, the algorithmic details of any solution get very complex. So, considering the time constraints, it is hard to develop a complete solution for this problem.
Algorithms
Overall description
Any full solution requires the development of the following two main algorithms.
- Cluster detection: This amounts to the classical problem of detecting the connected components of a graph;
- Cluster comparison: Two clusters
and are compared according to the possible combinations of rotation/reflection
Cluster comparison
The best way to perform the comparison of cluster
There are alternative methods for comparing cluster
The program does not need to keep a record for every cluster in the map. In fact, while scanning the map, it is enough to record one representative cluster for each distinct shape that comes across. The clusters that are not representative are simply marked with the low case letter corresponding to their shape.
Comments