It's nothing much, actually. Simpliest solution is to read all the horses into massive, sort them by ascending/descending and compare elements by pair.
Althought, i couldn't pass the many horses task with just that... Maybe it's because i've used JS. Anyway, i had to optimize it to pass. I have used reference data type to build a linear structure and sort horses right away. Every horse in this structure remembers it's own power, address of a weaker horse and adress of a stronger one. When new horse is being read, it travels along the structure, seeking a pair of horses, between which it can be inserted. After it settles between them, the program compares it's strength with neighbours.
That way i could read, sort and compare horses in a single cycle. And i've got my 100%, at last