Rushhh's blog

By Rushhh, history, 5 weeks ago, In English

given a binary string s having length N*N. N is even.number of 1s in the string is equal to number of 0s in the string.you have to rearrange the string in the minimum possible swaps to make the string satisfy the following conditions,

1.if (i+1)%N — i%N =1 then s[i]+s[i+1] =1

2.if i+N < N*N then s[i]+s[i+N]=1

there are T test cases. 1<=T<=100 2<=N<=1000

 
 
 
 
  • Vote: I like it
  • -2
  • Vote: I do not like it

»
5 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by Rushhh (previous revision, new revision, compare).