thank you so. result is
1000 1100 1110 1100 is it right?? 2012/4/9 Luke Pebody <[email protected]> > The top row only needs to go down as far as row 3. So 4-3,3-2,1-2,2-3 > works. > > > > On 9 Apr 2012, at 04:21, Minseok Jang <[email protected]> wrote: > > in round2, 2009 problem A.Crazy Rows > > > ---------------------------------------------------------------------------------------- > > Problem > > You are given an *N* x *N* matrix with 0 and 1 values. You can swap any > two *adjacent* rows of the matrix. > > Your goal is to have all the 1 values in the matrix below or on the main > diagonal. That is, for each X where 1 ≤ X ≤ N, there must be no 1 values in > row X that are to the right of column X. > > Return the minimum number of row swaps you need to achieve the goal. > > Input > > The first line of input gives the number of cases, *T*. *T* test cases > follow. > The first line of each test case has one integer, *N*. Each of the next *N > * lines contains *N* characters. Each character is either 0 or 1. > > Output > > For each test case, output > > Case #X: K > > where *X* is the test case number, starting from 1, and *K* is the > minimum number of row swaps needed to have all the 1 values in the matrix > below or on the main diagonal. > > You are guaranteed that there is a solution for each test case. > > > ----------------------------------------------------------------------------------------------- > > > > my question is in sample in/out > > input > > 1110 > 1100 > 1100 > 1000 > > output # 4 > > how can output get the "4" > > isn't it five?? > > please , someone let me know each step for that > > > > > > -- > You received this message because you are subscribed to the Google Groups > "Google Code Jam" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-code?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "Google Code Jam" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-code?hl=en. > -- You received this message because you are subscribed to the Google Groups "Google Code Jam" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-code?hl=en.
