rkpinto's blog

By rkpinto, history, 6 years ago, In English

Can someone help me with 158B - Taxi ? I followed the editiorial .
I took the number of 4's and added them to the number of taxis, then I combined the 3's with 1's.
Now, either (i) 3's are in excess or (ii) 1's are in excess or (iii) none of the 1's or 3's are left.
I combined the 2's with themselves.
Now, either (a) an extra 2 is left or (b) isn't.
Taking these 6 cases:
(i)(a) I added the number of 3's left to the answer and the 2 goes in a seperate taxi.
(ii)(a) I added at max two 1's with the 2, and then combined the remaining 1's in groups of fours.
(iii)(a) only that last 2 is left, which goes separately.
(i)(b) I added the number of 3's left to the answer.
(ii)(b) I combined the remaining 1's in groups of four.
(iii)(b) nothing is left, everyone has been grouped.
It seems to work, but I'm getting a wrong answer on test case 66. (49551813) The test case is too big and isn't shown fully. I can't find where it's wrong. Can someone help?

Full text and comments »

  • Vote: I like it
  • +4
  • Vote: I do not like it