Any hints for solving LIGHTIN spoj problem

Here is the problem link