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:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2060

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: