uiz Space

September 2023 term · Advanced Algorithms · BSCS4021

Advanced Algorithms Quiz 1: 29 October 2023 (September 2023 term)

The IIT Madras BS Advanced Algorithms (Advanced Algorithms) Quiz 1 paper sat on 29 Oct 2023, in the September 2023 term: 21 questions for 50 marks in 120 minutes. Every question is below with its answer. Take it as a timed mock test to be marked, or read it through first.

Questions
21
Marks
50
Duration
120 min
MCQ
12
Numerical
8
MSQ
1

Updated

Official paper: IIT M DEGREE AN2 EXAM QPE2 29 Oct 2023 · No negative marking.

Question 1

+3 marksOne correct option

Which of the following statements is true?

Statement 1: For every graph GG and every maximum flow on GG, there always exists an edge such that increasing the capacity on that edge will increase the maximum flow that's possible in the graph.

Statement 2: Suppose the maximum (s,t)(s,t)-flow of some graph has value ff. Now we increase the capacity of every edge by 1. Then the maximum (s,t)(s,t)-flow in this modified graph will have value at most f+1f + 1.

  1. A

    Statement 1

  2. B

    Statement 2

  3. C

    Both statements

  4. D

    Neither statement

Show answer

Correct answer

  • D

    Neither statement

Question 2

+2 marksOne correct option

Consider the following instance of the stable matching problem for 4 men (PQRS) and 4 women (WXYZ).

P: W > X > Y > Z
Q: X > Y > Z > W
R: W > X > Z > Y
S: X > Y > W > Z

and

W: S > Q > R > P
X: P > S > Q > R
Y: R > P > Q > S
Z: R > P > S > Q

Consider the following matching: M = {(P, W), (Q, X), (R, Z), (S, Y)}.

Which of the following is a blocking pair in the matching above?

  1. A

    (P-X)

  2. B

    (Q-Y)

  3. C

    (R-W)

  4. D

    (S-X)

Show answer

Correct answer

  • D

    (S-X)

Question 3

+3 marksNumerical answer

Consider 4 sets as follows: W={w1,w2,w3}W = \{w_1, w_2, w_3\}, X={x1,x2}X = \{x_1, x_2\}, Y={y1,y2,y3}Y = \{y_1, y_2, y_3\} and Z={z1,z2}Z = \{z_1, z_2\}. Suppose we are also given capacity constraints are as follows:

c(w2)=c(y1)=c(y3)=1,c(w_2) = c(y_1) = c(y_3) = 1,

c(w1)=c(w3)=c(x2)=c(y2)=c(z1)=2,c(w_1) = c(w_3) = c(x_2) = c(y_2) = c(z_1) = 2,

c(x1)=c(z2)=3c(x_1) = c(z_2) = 3

c(wi,xj)=1, for all wi∈W and all xj∈X,c(w_i, x_j) = 1, \text{ for all } w_i \in W \text{ and all } x_j \in X,

c(yi,zj)=1, for all yi∈Y and all zj∈Zc(y_i, z_j) = 1, \text{ for all } y_i \in Y \text{ and all } z_j \in Z

c(x1,y1)=1,c(x1,y2)=2,c(x1,y3)=1c(x_1, y_1) = 1, c(x_1, y_2) = 2, c(x_1, y_3) = 1

c(x2,y1)=0,c(x2,y2)=2,c(x2,y3)=1.c(x_2, y_1) = 0, c(x_2, y_2) = 2, c(x_2, y_3) = 1.

Identify the size of a largest collection of 4-tuples from the sets W,X,YW, X, Y and ZZ satisfying the given constraints.

Show answer

Correct answer: 23

Question 4

+3 marksOne or more correct options

Select all that apply.

  1. A
  2. B
  3. C
  4. D
Show answer

Correct answers

  • A
  • D

Question 5

+3 marksNumerical answer
Show answer

Correct answer: 23

Question 6

+3 marksNumerical answer
Show answer

Correct answer: 1

Question 7

+3 marksOne correct option

There are NN stones, numbered 1,2,…,N1, 2, \ldots, N. For each (1⩽i⩽N)(1 \leqslant i \leqslant N), the height of stone ii is hih_i. Assume these heights are stored in an array HH.

There is a frog who is initially on Stone 1. He will repeat the following action some number of times to reach Stone NN:

  • If the frog is currently on Stone ii, jump to Stone i+1i + 1 or Stone i+2i + 2.
  • Here, a cost of ∣hi−hj∣|h_i - h_j| is incurred, where jj is the stone to land on.

Our goal is to find the minimum possible total cost incurred before the frog reaches Stone NN.

Towards solving this problem, note that the frog, can jump to only (i + 1) or (i + 2) from a position i. We will now try to define a recurrence that leads us to the solution.

For all 1⩽i⩽N1 \leqslant i \leqslant N, define dp[i] as the minimum cost we can achieve to reach stone i. For our base cases, note that we have the following:

  • dp[0] = 0 and
  • dp[1] = abs(H[1] — H[0]) as if we are on the second stone (0 based indexing), there is only one way to reach it i.e from the first stone.

Based on the above data, answer the given subquestions.

Which of the following is a valid recurrence for dp[i]?

  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • B

Question 8

+2 marksNumerical answer

There are NN stones, numbered 1,2,…,N1, 2, \ldots, N. For each (1⩽i⩽N)(1 \leqslant i \leqslant N), the height of stone ii is hih_i. Assume these heights are stored in an array HH.

There is a frog who is initially on Stone 1. He will repeat the following action some number of times to reach Stone NN:

  • If the frog is currently on Stone ii, jump to Stone i+1i + 1 or Stone i+2i + 2.
  • Here, a cost of ∣hi−hj∣|h_i - h_j| is incurred, where jj is the stone to land on.

Our goal is to find the minimum possible total cost incurred before the frog reaches Stone NN.

Towards solving this problem, note that the frog, can jump to only (i + 1) or (i + 2) from a position i. We will now try to define a recurrence that leads us to the solution.

For all 1⩽i⩽N1 \leqslant i \leqslant N, define dp[i] as the minimum cost we can achieve to reach stone i. For our base cases, note that we have the following:

  • dp[0] = 0 and
  • dp[1] = abs(H[1] — H[0]) as if we are on the second stone (0 based indexing), there is only one way to reach it i.e from the first stone.

Based on the above data, answer the given subquestions.

Show answer

Correct answer: 4

Question 9

+2 marksNumerical answer

There are NN stones, numbered 1,2,…,N1, 2, \ldots, N. For each (1⩽i⩽N)(1 \leqslant i \leqslant N), the height of stone ii is hih_i. Assume these heights are stored in an array HH.

There is a frog who is initially on Stone 1. He will repeat the following action some number of times to reach Stone NN:

  • If the frog is currently on Stone ii, jump to Stone i+1i + 1 or Stone i+2i + 2.
  • Here, a cost of ∣hi−hj∣|h_i - h_j| is incurred, where jj is the stone to land on.

Our goal is to find the minimum possible total cost incurred before the frog reaches Stone NN.

Towards solving this problem, note that the frog, can jump to only (i + 1) or (i + 2) from a position i. We will now try to define a recurrence that leads us to the solution.

For all 1⩽i⩽N1 \leqslant i \leqslant N, define dp[i] as the minimum cost we can achieve to reach stone i. For our base cases, note that we have the following:

  • dp[0] = 0 and
  • dp[1] = abs(H[1] — H[0]) as if we are on the second stone (0 based indexing), there is only one way to reach it i.e from the first stone.

Based on the above data, answer the given subquestions.

Show answer

Correct answer: 68

Question 10

+1 markNumerical answer

Consider the following process. At all times you have a single positive integer xx, which is initially equal to 1 . In each step, you can either increment xx or double xx. Your goal is to produce a target value nn. For example, you can produce the integer 10 in four steps as follows:

1→+12→×24→+15→×2101 \xrightarrow{+1} 2 \xrightarrow{\times 2} 4 \xrightarrow{+1} 5 \xrightarrow{\times 2} 10

Obviously you can produce any integer nn using exactly n−1n - 1 increments, but for almost all values of nn, this is horribly inefficient.

Based on the above data, answer the given subquestions.

Show answer

Correct answer: 10

Question 11

+2 marksNumerical answer

Consider the following process. At all times you have a single positive integer xx, which is initially equal to 1 . In each step, you can either increment xx or double xx. Your goal is to produce a target value nn. For example, you can produce the integer 10 in four steps as follows:

1→+12→×24→+15→×2101 \xrightarrow{+1} 2 \xrightarrow{\times 2} 4 \xrightarrow{+1} 5 \xrightarrow{\times 2} 10

Obviously you can produce any integer nn using exactly n−1n - 1 increments, but for almost all values of nn, this is horribly inefficient.

Based on the above data, answer the given subquestions.

Show answer

Correct answer: 12

Question 12

+3 marksNumerical answer

Consider the following process. At all times you have a single positive integer xx, which is initially equal to 1 . In each step, you can either increment xx or double xx. Your goal is to produce a target value nn. For example, you can produce the integer 10 in four steps as follows:

1→+12→×24→+15→×2101 \xrightarrow{+1} 2 \xrightarrow{\times 2} 4 \xrightarrow{+1} 5 \xrightarrow{\times 2} 10

Obviously you can produce any integer nn using exactly n−1n - 1 increments, but for almost all values of nn, this is horribly inefficient.

Based on the above data, answer the given subquestions.

Show answer

Correct answer: 15

Question 13

+3 marksOne correct option

A game of Nim is played with nn heaps that have a1,…,ana_1, \ldots, a_n stones (in other words, the ii-th heap has aia_i stones). The rules of Nim are not relevant to this problem. We only note that the first player wins if and only if the bitwise xor a1⊕⋯⊕ana_1 \oplus \cdots \oplus a_n is non-zero.

Alice and Bob are playing the following game. Both Alice and Bob have several boxes with heaps. In the first phase they pick exactly one heap from each box. In the second phase Alice chooses some nonempty subset of those heaps, and the regular Nim game starts on chosen heaps with Bob to move first.

Bob already knows which heaps Alice picked. Our goal is to help him to perform his picks so that he wins the game no matter which heaps Alice chooses during the second phase.

For example, suppose Alice has picked two heaps with one and two stones, and Bob has two boxes:

  • The first box has two heaps of sizes one and three stones.
  • The second box has two heaps of sizes two and four stones.

Then notice that no matter what Bob picks, Alice can always pick a subset whose XOR sum is zero:

  • If Bob picks 1,2, Alice picks 1,2,1,2 (1,1 or 2,2 would also work)
  • If Bob picks 1,4, Alice picks 1,1
  • If Bob picks 3,2, Alice picks 2,2
  • If Bob picks 3,4, Alice picks 1,2,3

However suppose Alice has picked one heap with one stone, and Bob has two boxes:

  • The first box has two heaps of sizes three and five stones.
  • The second box has two heaps of sizes seven and four stones.

Then Bob can pick the heap with three stones from the first box and seven stones from the second, and no matter which non-empty subset of heaps Alice picks from (1,3,7)(1, 3, 7), the XOR sum will be nonzero and Bob will win the game:

  • 3⊕2⊕7=63 \oplus 2 \oplus 7 = 6,
  • 3⊕2=1,3⊕7=4,2⊕7=53 \oplus 2 = 1, 3 \oplus 7 = 4, 2 \oplus 7 = 5,
  • and singleton subsets are already nonzero.

Assume that all heap sizes are positive integers between 11 and 2102^{10}.

Based on the above data, answer the given subquestions.

Suppose Alice has two heaps of sizes one and five, and Bob has one box with three heaps of sizes 1, 3, and 5 respectively. Can Bob pick a heap to ensure a win?

  1. A

    Yes

  2. B

    No

Show answer

Correct answer

  • A

    Yes

Question 14

+3 marksOne correct option

A game of Nim is played with nn heaps that have a1,…,ana_1, \ldots, a_n stones (in other words, the ii-th heap has aia_i stones). The rules of Nim are not relevant to this problem. We only note that the first player wins if and only if the bitwise xor a1⊕⋯⊕ana_1 \oplus \cdots \oplus a_n is non-zero.

Alice and Bob are playing the following game. Both Alice and Bob have several boxes with heaps. In the first phase they pick exactly one heap from each box. In the second phase Alice chooses some nonempty subset of those heaps, and the regular Nim game starts on chosen heaps with Bob to move first.

Bob already knows which heaps Alice picked. Our goal is to help him to perform his picks so that he wins the game no matter which heaps Alice chooses during the second phase.

For example, suppose Alice has picked two heaps with one and two stones, and Bob has two boxes:

  • The first box has two heaps of sizes one and three stones.
  • The second box has two heaps of sizes two and four stones.

Then notice that no matter what Bob picks, Alice can always pick a subset whose XOR sum is zero:

  • If Bob picks 1,2, Alice picks 1,2,1,2 (1,1 or 2,2 would also work)
  • If Bob picks 1,4, Alice picks 1,1
  • If Bob picks 3,2, Alice picks 2,2
  • If Bob picks 3,4, Alice picks 1,2,3

However suppose Alice has picked one heap with one stone, and Bob has two boxes:

  • The first box has two heaps of sizes three and five stones.
  • The second box has two heaps of sizes seven and four stones.

Then Bob can pick the heap with three stones from the first box and seven stones from the second, and no matter which non-empty subset of heaps Alice picks from (1,3,7)(1, 3, 7), the XOR sum will be nonzero and Bob will win the game:

  • 3⊕2⊕7=63 \oplus 2 \oplus 7 = 6,
  • 3⊕2=1,3⊕7=4,2⊕7=53 \oplus 2 = 1, 3 \oplus 7 = 4, 2 \oplus 7 = 5,
  • and singleton subsets are already nonzero.

Assume that all heap sizes are positive integers between 11 and 2102^{10}.

Based on the above data, answer the given subquestions.

Suppose Alice has five heaps of sizes 1, 2, 3, 4, 5, and Bob has two boxes: one with three heaps of sizes 6, 7, 8, and another one with two heaps of sizes 9 and 10. Can Bob pick one heap from each box to ensure a win?

  1. A

    Yes

  2. B

    No

Show answer

Correct answer

  • B

    No

Question 15

+2 marksOne correct option

A game of Nim is played with nn heaps that have a1,…,ana_1, \ldots, a_n stones (in other words, the ii-th heap has aia_i stones). The rules of Nim are not relevant to this problem. We only note that the first player wins if and only if the bitwise xor a1⊕⋯⊕ana_1 \oplus \cdots \oplus a_n is non-zero.

Alice and Bob are playing the following game. Both Alice and Bob have several boxes with heaps. In the first phase they pick exactly one heap from each box. In the second phase Alice chooses some nonempty subset of those heaps, and the regular Nim game starts on chosen heaps with Bob to move first.

Bob already knows which heaps Alice picked. Our goal is to help him to perform his picks so that he wins the game no matter which heaps Alice chooses during the second phase.

For example, suppose Alice has picked two heaps with one and two stones, and Bob has two boxes:

  • The first box has two heaps of sizes one and three stones.
  • The second box has two heaps of sizes two and four stones.

Then notice that no matter what Bob picks, Alice can always pick a subset whose XOR sum is zero:

  • If Bob picks 1,2, Alice picks 1,2,1,2 (1,1 or 2,2 would also work)
  • If Bob picks 1,4, Alice picks 1,1
  • If Bob picks 3,2, Alice picks 2,2
  • If Bob picks 3,4, Alice picks 1,2,3

However suppose Alice has picked one heap with one stone, and Bob has two boxes:

  • The first box has two heaps of sizes three and five stones.
  • The second box has two heaps of sizes seven and four stones.

Then Bob can pick the heap with three stones from the first box and seven stones from the second, and no matter which non-empty subset of heaps Alice picks from (1,3,7)(1, 3, 7), the XOR sum will be nonzero and Bob will win the game:

  • 3⊕2⊕7=63 \oplus 2 \oplus 7 = 6,
  • 3⊕2=1,3⊕7=4,2⊕7=53 \oplus 2 = 1, 3 \oplus 7 = 4, 2 \oplus 7 = 5,
  • and singleton subsets are already nonzero.

Assume that all heap sizes are positive integers between 11 and 2102^{10}.

Based on the above data, answer the given subquestions.

Suppose Alice has two heaps of the same size. Who wins in this setting?

  1. A

    Alice can ensure a win no matter what is there in Bob’s boxes

  2. B

    Bob can ensure a win no matter what is there in his boxes

  3. C

    It depends on the heap sizes in Bob’s boxes and/or Bob’s strategy

Show answer

Correct answer

  • A

    Alice can ensure a win no matter what is there in Bob’s boxes

Question 16

+2 marksOne correct option

A game of Nim is played with nn heaps that have a1,…,ana_1, \ldots, a_n stones (in other words, the ii-th heap has aia_i stones). The rules of Nim are not relevant to this problem. We only note that the first player wins if and only if the bitwise xor a1⊕⋯⊕ana_1 \oplus \cdots \oplus a_n is non-zero.

Alice and Bob are playing the following game. Both Alice and Bob have several boxes with heaps. In the first phase they pick exactly one heap from each box. In the second phase Alice chooses some nonempty subset of those heaps, and the regular Nim game starts on chosen heaps with Bob to move first.

Bob already knows which heaps Alice picked. Our goal is to help him to perform his picks so that he wins the game no matter which heaps Alice chooses during the second phase.

For example, suppose Alice has picked two heaps with one and two stones, and Bob has two boxes:

  • The first box has two heaps of sizes one and three stones.
  • The second box has two heaps of sizes two and four stones.

Then notice that no matter what Bob picks, Alice can always pick a subset whose XOR sum is zero:

  • If Bob picks 1,2, Alice picks 1,2,1,2 (1,1 or 2,2 would also work)
  • If Bob picks 1,4, Alice picks 1,1
  • If Bob picks 3,2, Alice picks 2,2
  • If Bob picks 3,4, Alice picks 1,2,3

However suppose Alice has picked one heap with one stone, and Bob has two boxes:

  • The first box has two heaps of sizes three and five stones.
  • The second box has two heaps of sizes seven and four stones.

Then Bob can pick the heap with three stones from the first box and seven stones from the second, and no matter which non-empty subset of heaps Alice picks from (1,3,7)(1, 3, 7), the XOR sum will be nonzero and Bob will win the game:

  • 3⊕2⊕7=63 \oplus 2 \oplus 7 = 6,
  • 3⊕2=1,3⊕7=4,2⊕7=53 \oplus 2 = 1, 3 \oplus 7 = 4, 2 \oplus 7 = 5,
  • and singleton subsets are already nonzero.

Assume that all heap sizes are positive integers between 11 and 2102^{10}.

Based on the above data, answer the given subquestions.

Suppose Bob has bb boxes. Let SiS_i denote set of heap sizes in the ii-th box. Let SS denote the set of heap sizes that Alice has. Interpret each heap size as a 10-length bit vector (adding leading zeroes as necessary) based on the binary representation of the number: for example, a heap of size 55 would be ⟨0,0,0,0,0,0,0,1,0,1⟩\langle 0, 0, 0, 0, 0, 0, 0, 1, 0, 1 \rangle. Therefore, all heap sizes are elements of the vector space F210\mathbb{F}_2^{10}, where F2\mathbb{F}_2 is the field over two elements {0,1}\{0, 1\} with the operation being addition modulo two. If Bob selects heaps with sizes hi∈Sih_i \in S_i and these choices guarantee a win for Bob, then the set {hi1⩽i≤b}∪S\{h_i \quad 1 \leqslant i \leq b\} \cup S is:

  1. A
  2. B
  3. C
Show answer

Correct answer

  • B

Question 17

+2 marksOne correct option

A game of Nim is played with nn heaps that have a1,…,ana_1, \ldots, a_n stones (in other words, the ii-th heap has aia_i stones). The rules of Nim are not relevant to this problem. We only note that the first player wins if and only if the bitwise xor a1⊕⋯⊕ana_1 \oplus \cdots \oplus a_n is non-zero.

Alice and Bob are playing the following game. Both Alice and Bob have several boxes with heaps. In the first phase they pick exactly one heap from each box. In the second phase Alice chooses some nonempty subset of those heaps, and the regular Nim game starts on chosen heaps with Bob to move first.

Bob already knows which heaps Alice picked. Our goal is to help him to perform his picks so that he wins the game no matter which heaps Alice chooses during the second phase.

For example, suppose Alice has picked two heaps with one and two stones, and Bob has two boxes:

  • The first box has two heaps of sizes one and three stones.
  • The second box has two heaps of sizes two and four stones.

Then notice that no matter what Bob picks, Alice can always pick a subset whose XOR sum is zero:

  • If Bob picks 1,2, Alice picks 1,2,1,2 (1,1 or 2,2 would also work)
  • If Bob picks 1,4, Alice picks 1,1
  • If Bob picks 3,2, Alice picks 2,2
  • If Bob picks 3,4, Alice picks 1,2,3

However suppose Alice has picked one heap with one stone, and Bob has two boxes:

  • The first box has two heaps of sizes three and five stones.
  • The second box has two heaps of sizes seven and four stones.

Then Bob can pick the heap with three stones from the first box and seven stones from the second, and no matter which non-empty subset of heaps Alice picks from (1,3,7)(1, 3, 7), the XOR sum will be nonzero and Bob will win the game:

  • 3⊕2⊕7=63 \oplus 2 \oplus 7 = 6,
  • 3⊕2=1,3⊕7=4,2⊕7=53 \oplus 2 = 1, 3 \oplus 7 = 4, 2 \oplus 7 = 5,
  • and singleton subsets are already nonzero.

Assume that all heap sizes are positive integers between 11 and 2102^{10}.

Based on the above data, answer the given subquestions.

Let bb be a positive integer. For this question, we refer to the numbers {1,…b}\{1, \ldots b\} as colors.

Consider the following set system (U,F)(U, \mathcal{F}):

  • the universe UU is a set of numbers, and each number is colored with a color from {1,…,b}\{1, \ldots, b\}, and
  • a subset S⊆US \subseteq U belongs to F\mathcal{F} if and only if SS contains exactly one element of UU of each color.

For example, if b=2b = 2 and U={23,32,41,56,90,95}U = \{23, 32, 41, 56, 90, 95\}, where the odd elements have color 11 and even elements have color 22, then the family F\mathcal{F} consists exactly of two-sized subsets of UU that have one odd element and one even element.

Now, if b=3b = 3 and U={11,22,33,44,55,66,77,88,99}U = \{11, 22, 33, 44, 55, 66, 77, 88, 99\}, where the elements {11,22,33}\{11, 22, 33\} have color 11, {44,55,66}\{44, 55, 66\} have color 22, and {77,88,99}\{77, 88, 99\} have color 33, then which of the following sets belong to F\mathcal{F}?

  1. A

    {11, 22, 66}

  2. B

    {44, 77, 99}

  3. C

    {11, 55, 99}

  4. D

    {33, 88}

Show answer

Correct answer

  • C

    {11, 55, 99}

Question 18

+2 marksOne correct option

A game of Nim is played with nn heaps that have a1,…,ana_1, \ldots, a_n stones (in other words, the ii-th heap has aia_i stones). The rules of Nim are not relevant to this problem. We only note that the first player wins if and only if the bitwise xor a1⊕⋯⊕ana_1 \oplus \cdots \oplus a_n is non-zero.

Alice and Bob are playing the following game. Both Alice and Bob have several boxes with heaps. In the first phase they pick exactly one heap from each box. In the second phase Alice chooses some nonempty subset of those heaps, and the regular Nim game starts on chosen heaps with Bob to move first.

Bob already knows which heaps Alice picked. Our goal is to help him to perform his picks so that he wins the game no matter which heaps Alice chooses during the second phase.

For example, suppose Alice has picked two heaps with one and two stones, and Bob has two boxes:

  • The first box has two heaps of sizes one and three stones.
  • The second box has two heaps of sizes two and four stones.

Then notice that no matter what Bob picks, Alice can always pick a subset whose XOR sum is zero:

  • If Bob picks 1,2, Alice picks 1,2,1,2 (1,1 or 2,2 would also work)
  • If Bob picks 1,4, Alice picks 1,1
  • If Bob picks 3,2, Alice picks 2,2
  • If Bob picks 3,4, Alice picks 1,2,3

However suppose Alice has picked one heap with one stone, and Bob has two boxes:

  • The first box has two heaps of sizes three and five stones.
  • The second box has two heaps of sizes seven and four stones.

Then Bob can pick the heap with three stones from the first box and seven stones from the second, and no matter which non-empty subset of heaps Alice picks from (1,3,7)(1, 3, 7), the XOR sum will be nonzero and Bob will win the game:

  • 3⊕2⊕7=63 \oplus 2 \oplus 7 = 6,
  • 3⊕2=1,3⊕7=4,2⊕7=53 \oplus 2 = 1, 3 \oplus 7 = 4, 2 \oplus 7 = 5,
  • and singleton subsets are already nonzero.

Assume that all heap sizes are positive integers between 11 and 2102^{10}.

Based on the above data, answer the given subquestions.

Consider the set system from the previous question. Does it form a matroid?

  1. A

    Yes

  2. B

    No

Show answer

Correct answer

  • B

    No

Question 19

+2 marksOne correct option

A game of Nim is played with nn heaps that have a1,…,ana_1, \ldots, a_n stones (in other words, the ii-th heap has aia_i stones). The rules of Nim are not relevant to this problem. We only note that the first player wins if and only if the bitwise xor a1⊕⋯⊕ana_1 \oplus \cdots \oplus a_n is non-zero.

Alice and Bob are playing the following game. Both Alice and Bob have several boxes with heaps. In the first phase they pick exactly one heap from each box. In the second phase Alice chooses some nonempty subset of those heaps, and the regular Nim game starts on chosen heaps with Bob to move first.

Bob already knows which heaps Alice picked. Our goal is to help him to perform his picks so that he wins the game no matter which heaps Alice chooses during the second phase.

For example, suppose Alice has picked two heaps with one and two stones, and Bob has two boxes:

  • The first box has two heaps of sizes one and three stones.
  • The second box has two heaps of sizes two and four stones.

Then notice that no matter what Bob picks, Alice can always pick a subset whose XOR sum is zero:

  • If Bob picks 1,2, Alice picks 1,2,1,2 (1,1 or 2,2 would also work)
  • If Bob picks 1,4, Alice picks 1,1
  • If Bob picks 3,2, Alice picks 2,2
  • If Bob picks 3,4, Alice picks 1,2,3

However suppose Alice has picked one heap with one stone, and Bob has two boxes:

  • The first box has two heaps of sizes three and five stones.
  • The second box has two heaps of sizes seven and four stones.

Then Bob can pick the heap with three stones from the first box and seven stones from the second, and no matter which non-empty subset of heaps Alice picks from (1,3,7)(1, 3, 7), the XOR sum will be nonzero and Bob will win the game:

  • 3⊕2⊕7=63 \oplus 2 \oplus 7 = 6,
  • 3⊕2=1,3⊕7=4,2⊕7=53 \oplus 2 = 1, 3 \oplus 7 = 4, 2 \oplus 7 = 5,
  • and singleton subsets are already nonzero.

Assume that all heap sizes are positive integers between 11 and 2102^{10}.

Based on the above data, answer the given subquestions.

Consider a slight modification of the set system introduced earlier. As before, let bb be a positive integer. We again refer to the numbers {1,…b}\{1, \ldots b\} as colors.

Consider the following set system (U,F)(U, \mathcal{F}):

  • the universe UU is a set of numbers, and each number is colored with a color from {1,…,b}\{1, \ldots, b\}, and
  • a subset S⊆US \subseteq U belongs to F\mathcal{F} if and only if SS contains at most one element of UU of each color.

Now, if b=3b = 3 and U={11,22,33,44,55,66,77,88,99}U = \{11, 22, 33, 44, 55, 66, 77, 88, 99\}, where the elements {11,22,33}\{11, 22, 33\} have color 11, {44,55,66}\{44, 55, 66\} have color 22, and {77,88,99}\{77, 88, 99\} have color 33, then which of the following sets belong to F\mathcal{F}?

  1. A

    {11, 22}

  2. B

    {44, 88, 99}

  3. C

    {11, 33, 99}

  4. D

    {55, 77}

Show answer

Correct answer

  • D

    {55, 77}

Question 20

+2 marksOne correct option

A game of Nim is played with nn heaps that have a1,…,ana_1, \ldots, a_n stones (in other words, the ii-th heap has aia_i stones). The rules of Nim are not relevant to this problem. We only note that the first player wins if and only if the bitwise xor a1⊕⋯⊕ana_1 \oplus \cdots \oplus a_n is non-zero.

Alice and Bob are playing the following game. Both Alice and Bob have several boxes with heaps. In the first phase they pick exactly one heap from each box. In the second phase Alice chooses some nonempty subset of those heaps, and the regular Nim game starts on chosen heaps with Bob to move first.

Bob already knows which heaps Alice picked. Our goal is to help him to perform his picks so that he wins the game no matter which heaps Alice chooses during the second phase.

For example, suppose Alice has picked two heaps with one and two stones, and Bob has two boxes:

  • The first box has two heaps of sizes one and three stones.
  • The second box has two heaps of sizes two and four stones.

Then notice that no matter what Bob picks, Alice can always pick a subset whose XOR sum is zero:

  • If Bob picks 1,2, Alice picks 1,2,1,2 (1,1 or 2,2 would also work)
  • If Bob picks 1,4, Alice picks 1,1
  • If Bob picks 3,2, Alice picks 2,2
  • If Bob picks 3,4, Alice picks 1,2,3

However suppose Alice has picked one heap with one stone, and Bob has two boxes:

  • The first box has two heaps of sizes three and five stones.
  • The second box has two heaps of sizes seven and four stones.

Then Bob can pick the heap with three stones from the first box and seven stones from the second, and no matter which non-empty subset of heaps Alice picks from (1,3,7)(1, 3, 7), the XOR sum will be nonzero and Bob will win the game:

  • 3⊕2⊕7=63 \oplus 2 \oplus 7 = 6,
  • 3⊕2=1,3⊕7=4,2⊕7=53 \oplus 2 = 1, 3 \oplus 7 = 4, 2 \oplus 7 = 5,
  • and singleton subsets are already nonzero.

Assume that all heap sizes are positive integers between 11 and 2102^{10}.

Based on the above data, answer the given subquestions.

Consider the modified set system from the previous question. Does it form a matroid?

  1. A

    Yes

  2. B

    No

Show answer

Correct answer

  • A

    Yes

Question 21

+2 marksOne correct option

A game of Nim is played with nn heaps that have a1,…,ana_1, \ldots, a_n stones (in other words, the ii-th heap has aia_i stones). The rules of Nim are not relevant to this problem. We only note that the first player wins if and only if the bitwise xor a1⊕⋯⊕ana_1 \oplus \cdots \oplus a_n is non-zero.

Alice and Bob are playing the following game. Both Alice and Bob have several boxes with heaps. In the first phase they pick exactly one heap from each box. In the second phase Alice chooses some nonempty subset of those heaps, and the regular Nim game starts on chosen heaps with Bob to move first.

Bob already knows which heaps Alice picked. Our goal is to help him to perform his picks so that he wins the game no matter which heaps Alice chooses during the second phase.

For example, suppose Alice has picked two heaps with one and two stones, and Bob has two boxes:

  • The first box has two heaps of sizes one and three stones.
  • The second box has two heaps of sizes two and four stones.

Then notice that no matter what Bob picks, Alice can always pick a subset whose XOR sum is zero:

  • If Bob picks 1,2, Alice picks 1,2,1,2 (1,1 or 2,2 would also work)
  • If Bob picks 1,4, Alice picks 1,1
  • If Bob picks 3,2, Alice picks 2,2
  • If Bob picks 3,4, Alice picks 1,2,3

However suppose Alice has picked one heap with one stone, and Bob has two boxes:

  • The first box has two heaps of sizes three and five stones.
  • The second box has two heaps of sizes seven and four stones.

Then Bob can pick the heap with three stones from the first box and seven stones from the second, and no matter which non-empty subset of heaps Alice picks from (1,3,7)(1, 3, 7), the XOR sum will be nonzero and Bob will win the game:

  • 3⊕2⊕7=63 \oplus 2 \oplus 7 = 6,
  • 3⊕2=1,3⊕7=4,2⊕7=53 \oplus 2 = 1, 3 \oplus 7 = 4, 2 \oplus 7 = 5,
  • and singleton subsets are already nonzero.

Assume that all heap sizes are positive integers between 11 and 2102^{10}.

Based on the above data, answer the given subquestions.

The solution that is sought by Bob can be viewed as the problem of finding a largest independent set in the:

  1. A
  2. B
  3. C
Show answer

Correct answer

  • A