segment trees

hey hi!!!
my code is giving WA for this spoj problem…

my code…

thanx in advance for the help///

//