new9934's blog

By new9934, history, 2 years ago, In English

How can I find out bitwise OR of elements of all possible strictly increasing subsequences present in an array? i have to find out that subsequence also.

Constraints

1≤T≤ 10

1<=N<=10^4

0 ≤ arri ≤ 500

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

| Write comment?
»
2 years ago, # |
  Vote: I like it +10 Vote: I do not like it

Or all elements

»
2 years ago, # |
  Vote: I like it +10 Vote: I do not like it

That's not a "doubt", a doubt is when you are confused or unsure about something, this is just plain "solve this problem".

Also there is clearly something missing from the statement. What is "that" subsequence? My best guess is that what you actually want to know is the maximum OR of all possible increasing subsequences, but that is only a pretty far-fetched guess.

  • »
    »
    2 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    ignore that second part, i want to store bitwise or of all increasing subsequence

    • »
      »
      »
      2 years ago, # ^ |
        Vote: I like it +8 Vote: I do not like it

      You can't (in reasonable time) store bitwise ORs of all increasing subsequences, there is an exponential number of them.

      I suggest you think and write very slowly, carefully and clearly what you actually need.