Spoj problem IPL1

I am trying to solve the SPOJ problem “Cricket Tournament

my solution :- http://ideone.com/uMkMgx

i am using 3D dp for wickets, balls and required runs then memorising all possible states

i am not getting why WA… but according to me it is working fine for all test cases…

plz can someone help???

thank u