B. Cat, Fox and the Lonely Array:- Am I thinking right....??

Revision en1, by saptarshikuar2003, 2025-02-15 17:35:03

problem link:- https://codeforces.net/problemset/problem/1973/B

here we have to determine the smallest possible value of k for which the below condition should be right that is for any i and j , 1<=i,j<=n...

a(i)|a(i+1)|.....|a(i+k-1)=a(j)|a(j+1)|.....|a(j+k-1)

Here the main Idea used is Binary search on answer......

If the segment of length k is working according to the conditions the k+1 will also be a right ans......

but how this occurs according to me-------

for a segment which not is capable to keep the bits same throughout all the subarrays of length k that means some integer in the array which can contribute to further to maintain the bits same

hence if it is not possible for k then it is also not possible for k-1......

hence binary search on answer........

am I thinking right.....????

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English saptarshikuar2003 2025-02-15 17:35:03 922 Initial revision (published)