uva chemical attraction getting WA

okk i think this is a very hard problem… coz only 17 people ever succeeded to get AC…

problem link:Online Judge

my code:http://codepad.org/k5rOaC0S

can u help me to find out the problemin my code or any idea to solve this???
thnx in advance :slight_smile: :slight_smile: