Hi, I tried the problem for practice and got correct answers to all but one of the small input test cases using a greedy strategy.
B-small-practice.in Case #38 Input: 3 2 6 1 2 1 1 3 1 2 2 2 1 3 2 Output (I got: 3 1) 3 0 My code is at https://ideone.com/Q6rnSx Unnecessary promotion occurs due to the seat assignment: Ride 1 = Seat 1: Customer 1 + Seat 2: Customer 2 Ride 2 = Seat 1: Customer 2 + Seat 2: Customer 1 Ride 3 = Seat 3: Customer 1 + Seat 3: Customer 2 (one of the seats need to be promoted) Can avoid this with the following seat assignment: Ride 1 = Seat 1: Customer 1 + Seat 2: Customer 2 Ride 2 = Seat 1: Customer 2 + Seat 2: Customer 3 Ride 3 = Seat 1: Customer 3 + Seat 2: Customer 1 I would appreciate either a simple fix for my greedy solution if possible or a different working greedy solution. Thanks -- You received this message because you are subscribed to the Google Groups "Google Code Jam" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/google-code/5ef8143a-9704-49e0-ad20-5f6b490b7a18%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
