Very well communicated. The problem is I think your step 4. Iteration-1: o....o ================== S1 : (L=0,R=3,min(LR)=0,max(LR)=3) S2 : (L=1,R=2,min(LR)=1,max(LR)=2) S3 : (L=2,R=1,min(LR)=1,max(LR)=2) S4 : (L=3,R=0,min(LR)=0,max(LR)=3)
According to the deterministic selection rules: 1. max(min(LR)) = 1; 2. Stall-Set(max(min(LR)) = (S2, S3); 3. I have more than one so I continue; *** HERE *** At this point, S2 and S3 are equally good, so the remainder of the algorithm is choosing between S2 and S3 only. S1 and S4 are 'thrown away' 4. max(max(LR)) = 2; 5. Stall-Set(max(max(LR)) = (S1, S4); <---- No, S1 and S4 were disregarded at step 3, this is still S2, S3 6. I have more than one so I choose the leftmost; The leftmost selection of S2 and S3 is S2. On Wed, 12 Apr 2017 at 16:32 Adebowale Odunlami <[email protected]> wrote: > I have some problems with the question C of the qualification round of the > contest. > I did not find the deterministic selection rules to be consistent with the > example > given especially case 1. I felt that I either did not understand the > question very > well or there was something wrong. I wrote the code according to my > understanding > but I could not attempt the question because of the inconsistency. > > Please kindly assist me to review my implementation which is expressed in > the steps below > and point out where mistake(s) could be. > I have used Java with streams. > > Case 1. > > N = 4; K = 2 > > Iteration-1: o....o > ================== > S1 : (L=0,R=3,min(LR)=0,max(LR)=3) > S2 : (L=1,R=2,min(LR)=1,max(LR)=2) > S3 : (L=2,R=1,min(LR)=1,max(LR)=2) > S4 : (L=3,R=0,min(LR)=0,max(LR)=3) > > According to the deterministic selection rules: > > 1. max(min(LR)) = 1; > 2. Stall-Set(max(min(LR)) = (S2, S3); > 3. I have more than one so I continue; > 4. max(max(LR)) = 2; > 5. Stall-Set(max(max(LR)) = (S1, S4); > 6. I have more than one so I choose the leftmost; > 7. Selection is S1; > > > Iteration-2: oo...o > ================== > S2 : (L=0,R=2,min(LR)=0,max(LR)=2) > S3 : (L=1,R=1,min(LR)=1,max(LR)=1) > S4 : (L=2,R=0,min(LR)=0,max(LR)=2) > > According to the deterministic selection rules: > > 1. max(min(LR)) = 1; > 2. Stall-Set(max(min(LR)) = (S3); > 3. I have only one so I choose it; > 4. Selection is S3; > > > Finally I have: oo.o.o > and max(LR)=1 : min(LR)=1. > So, my answer is Case #1: 1 1 > > > But the answer in the example is : Case #1: 1 0 > > > > -- > 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/0b34f5ed-e95b-4166-8fd2-41a5304293ca%40googlegroups.com > . > For more options, visit https://groups.google.com/d/optout. > -- 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/CAJej63K0KJ%3D0V4NCANbAfsmLXnbgC3UqA3ooEJ0%2BibDRpj4NJw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
