All submissions for this problem are available.
Problem Statement : JP is a fat guy. He likes chocolate too much. He likes only two types of chocolate, Dairy Milk and Perk. Once JP visits to his friend's house. His friend has n chocolate. Each chokelate is either Dairy Milk or Perk. The weight of i'th chocolate is m_i and hangs at height h_i. JP is greedy person. He wants to eat as much chocolate as possible. To get a chocolate he needs to jump up. Initially he can make high jump of y meters. When JP eats a chocolate then his high jump increased by mass of eaten chocolate. JP is not allowed to eat two chocolate of same type type in a row. What is the maximum number of chocolate JP can eat? INPUT : First line contain two integers n and y. Next n line contains three integers t_i, h_i and m_i. t_i is the type of chocolate (0 : Dairy Milk , 1 : Perk) All input will be in INTEGER range. OUTPUT : return maximim number of candies JP can eat. Example : input : 5 3 0 2 4 1 3 1 0 8 3 0 20 10 1 5 5 output : 4
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.5, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.