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.

Reply via email to