Daily Programming Dose Day 7

Hello Folks,

Sorry for the very very long interruption between the daily dose.I will be regular from now.

The following is the day 7 question.

You are given a list of  numbers and you will have a continuous flow of numbers coming in the list.

For every new number you need to tell that whether that number could be made using the numbers previously available in the list.

INPUT

The first line contains number m (1 ≤ m ≤ 2000), showing how many numbers are there goo be in the list.

The next m lines contain the numbers in the order in which the numbers are being put in the list. Each number is a positive integer strictly less than 10600 that doesn’t contain leading zeroes.

Output

For each number either print a 0 on the corresponding line, if the number cannot be represented as a XOR sum of numbers that are in the list, or print integer k showing how many numbers are in the representation and the indexes of these numbers. Separate the numbers by spaces. Each number can occur in the representation at most once.

Assume that the list was initially empty.

Sample test(s)
Input
7
7
6
5
4
3
2
1
Output
0
0
0
3 0 1 2
2 1 2
2 0 2
2 0 1
Input
2
5
5
Output
0
1 0

Comment any ideas or your way of approach to the question.

Advertisements

2 thoughts on “Daily Programming Dose Day 7

  1. Yes. I agree with Ajay. If you plan to put a problem directly from online judge, no need to copy paste the question here. Putting the link will be more feasible than copying the question here. Also, you can put the improved editorial of the question instead of the question.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s