SPOJ GSS1, Getting TLE EVEN after Fast IO

Question link : https://www.spoj.com/problems/GSS1/


I am getting TLE even after using FAST IO. PLZ HELP.