An Interesting Problem On Arrays

Правка en1, от rachitiitr, 2018-02-09 12:37:45


Its been a while that I've made some video on competitive programming.

The problem that I want to talk about today is:

You are given an array A of size N < 1000 with elements upto 1018.
You have to print any subset S such that:
1. The AND resultant of all elements in S is 0.
2. The AND resultant of any 2 elements in S is not 0.

The problem looks easy but is quite twisted, and can be solved once you pick up the hidden observation here.
I read this problem sometime back in Petr's blog and wanted to share the solution with you guys.

Check out the video here:

Its difficult to pick up such observations but this is what I like about Competitive Programming. It makes you smarter gradually and you start looking at things in a different manner.

Happy Coding!

Теги rachitjain, video lectures


  Rev. Язык Кто Когда Δ Комментарий
en1 Английский rachitiitr 2018-02-09 12:37:45 951 Initial revision (published)