Блог пользователя rachitiitr

Автор rachitiitr, история, 7 лет назад, По-английски

Hi

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: https://goo.gl/Pu9gZQ

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!

  • Проголосовать: нравится
  • +31
  • Проголосовать: не нравится

»
7 лет назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

Can you link the problem please if it is available on some judge?