0% found this document useful (0 votes)
34 views6 pages

Zio 2023

Uploaded by

indubasuroy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views6 pages

Zio 2023

Uploaded by

indubasuroy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Zonal Informatics Olympiad, 2023

Instructions to candidates

1. The question paper carries 80 marks, broken up into


four problems of 20 marks each. Each problem has
three Test Cases. If you solve all three Test Cases cor-
rectly, you get 20 marks for that problem. Otherwise,
you get 5 marks for each Test Case that you solve cor-
rectly.
2. All the 4 × 3 = 12 Test Cases appear as separate Ques-
tions in the right panel (“Question Palette”).
The first three Questions correspond to the three Test
Cases of Problem 1, the next three correspond to the
three Test Cases of Problem 2 and so on.
A question icon turning green in the Question Palette,
does not mean that it is correct. It just denotes that you
have attempted it. All the questions will be evaluated
later.
3. Attempt all questions. There are no optional questions.
4. There are no negative marks.
5. All expected answers are integers. Type in only the in-
teger. So, if your answer is “162”, enter only “162”. Not
“0162”, or “162.0”, etc.
6. Remember to save each answer. Only your final saved
answers will be considered.
7. Near the top-right corner, you should be able to see a
calculator icon. Clicking it pops up a calculator which
you may use.
1. There is an exam with N problems. For each problem, a participant can either choose
to answer the problem, or skip the problem. If the participant chooses to answer the
problem and gets it correct, the participant is awarded X points. If the participant
chooses to answer the problem but answers it incorrectly, 1 point is deducted from
their score. If the participant skipped the problem, there is no change to their score.
For each of the following values of N and X, compute the number of distinct scores
the participant could obtain in the exam:
(a) N = 7, X = 4
(b) N = 15, X = 18
(c) N = 30, X = 20

Page 2
2. There are N students standing in a line. Every student has a badge with a number
from 1 to M . Different students can have the same badge number, and they can also
have different badge numbers. For all 1 ≤ i ≤ N , the ith number in array A represents
the badge number of the ith student from the left of the line.
You want to choose any subset of these students, such that there are exactly K distinct
badge numbers amongst the chosen students. Note that it is guaranteed that K ≤ M .
Note: A subset is any (not necessarily contiguous) selection of the students from the
line. Two subsets are considered different if there exists a student i who is present in
one subset but not in the other.
For each of the following values of N , M and A, calculate the number of subsets of
students you can choose such that there are exactly K distinct badge numbers amongst
the chosen students.
(a) N = 12, M = 4, K = 1, A = [1, 2, 1, 2, 1, 3, 2, 2, 3, 3, 1, 1]
(b) N = 20, M = 5, K = 3, A = [2, 2, 5, 5, 3, 3, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 1, 1, 4, 4]
(c) N = 25, M = 10, K = 6, A = [10, 8, 4, 1, 4, 10, 9, 3, 9, 2, 1, 7, 7, 1, 8, 6, 8, 10, 8, 4, 7, 10, 9, 5, 8]

Page 3
3. A permutation is a sequence of N integers from 1 to N containing each integer exactly
once. For example, [1, 3, 2, 4, 5] and [4, 2, 3, 1] are permutations, but [1, 3] and [2, 3, 4, 5]
are not.
There is a permutation P of length N . You are not given the permutation, but you are
given, for all 1 ≤ l ≤ r ≤ N , the index of the minimum element among Pl , Pl+1 , . . . , Pr .
The data is displayed in a triangle-like table. For example:
r
1 2 3
1 1 2 2
l 2 2 2
3 3
The element in the lth row and rth column of the table represents the index of the
minimum element among Pl , Pl+1 , . . . , Pr . For the above table, [2, 1, 3] is a valid per-
mutation that could be used to construct it:

1. When l = 1 and r = 1, there is only one element so minimum is at index 1.


2. When l = 1 and r = 2, P1 = 2 and P2 = 1, so minimum is at index 2.
3. When l = 1 and r = 3, P1 = 2, P2 = 1 and P3 = 3, so minimum is at index 2.
4. When l = 2 and r = 2, there is only one element so minimum is at index 2.
5. When l = 2 and r = 3, P2 = 1 and P3 = 3, so minimum element is at index 2.
6. When l = 3 and r = 3, there is only one element so minimum is at index 3.

However, this is not the only valid permutation. For example, [3, 1, 2] is also a valid
permutation that could have been used to construct the table. Given a table, you are
asked to find how many permutations could have been used to construct it. (In the
previous example, the answer is 2, as those are the only two permutations that could
have been used to construct the table.)

Page 4
(a) N = 4
r
1 2 3 4
1 1 2 3 3
2 2 3 3
l
3 3 3
4 4
(b) N = 8
r
1 2 3 4 5 6 7 8
1 1 1 1 1 5 5 5 5
2 2 2 2 5 5 5 5
3 3 3 5 5 5 5
4 4 5 5 5 5
l
5 5 5 5 5
6 6 7 7
7 7 7
8 8
(c) N = 15
r
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
1 1 2 2 4 4 4 4 4 4 4 4 4 4 14 14
2 2 2 4 4 4 4 4 4 4 4 4 4 14 14
3 3 4 4 4 4 4 4 4 4 4 4 14 14
4 4 4 4 4 4 4 4 4 4 4 14 14
5 5 5 5 8 9 10 10 10 10 14 14
6 6 7 8 9 10 10 10 10 14 14
7 7 8 9 10 10 10 10 14 14
l 8 8 9 10 10 10 10 14 14
9 9 10 10 10 10 14 14
10 10 10 10 10 14 14
11 11 11 13 14 14
12 12 13 14 14
13 13 14 14
14 14 14
15 15

Page 5
4. There are N stones, numbered from 1 to N . You are sequentially given M relations.
Each relation is of the form “Stone Ai weighs Xi units more than Stone Bi ”.
After each relation is added, you want to find an assignment of positive integer weights
to each of the N stones such that all relations added so far are satisfied. Note that
this is cumulative; once the third constraint is added, you must satisfy all of the first
three constraints. Out of all valid assignments, pick the one with the lowest total sum
of weights across all stones. Your answer for this step is the sum of weights in the
assignment. It is guaranteed that there will always be at least one valid assignment of
weights.
Your answer for the overall problem is the sum of weights over all steps.
For example, say that N = 3, M = 2, A = [1, 2], B = [2, 3], X = [5, 6]. The first relation
is “Stone 1 weighs 5 units more than Stone 2”. The optimal assignment satisfying this
relation is for Stone 1 to have weight 6 and Stones 2 and 3 to have weight 1, for a total
of 8. Note that the stones cannot have weight 0.
The second relation is “Stone 2 weighs 6 units more than Stone 3”. The optimal
assignment satisfying both relations is Stone 1 weight 12, Stone 2 weight 7, Stone 3
weight 1, for a total of 20. Summing both steps, the answer is 8 + 20 = 28.
(a) N = 10, M = 6,
A = [6, 5, 1, 2, 3, 3],
B = [2, 9, 10, 5, 2, 8],
X = [5, 4, 4, 1, 4, 2]
(b) N = 23, M = 22,
A = [11, 20, 12, 8, 20, 21, 5, 14, 7, 14, 21, 20, 23, 23, 23, 16, 11, 15, 11, 17, 11, 18],
B = [20, 12, 8, 13, 21, 5, 14, 7, 4, 19, 2, 23, 3, 9, 16, 1, 15, 10, 17, 6, 18, 22],
X = [16, 15, 16, 14, 13, 24, 18, 8, 17, 18, 12, 25, 21, 21, 12, 10, 23, 21, 3, 4, 12, 13]
(c) N = 30, M = 32
A = [18, 28, 27, 2, 21, 20, 12, 7, 13, 11, 30, 10, 2, 16, 7, 21, 16, 20, 6, 11, 16, 20, 15, 18, 11, 6, 27, 1, 2, 28, 2, 4]
B = [5, 3, 18, 1, 22, 29, 25, 9, 5, 8, 29, 12, 17, 19, 13, 26, 1, 10, 10, 14, 23, 29, 12, 21, 24, 3, 15, 8, 3, 12, 5, 3]
X = [2, 5, 5, 2, 2, 5, 5, 2, 1, 1, 5, 5, 3, 5, 1, 2, 4, 4, 4, 3, 2, 5, 1, 5, 4, 3, 13, 2, 5, 11, 4, 2]

Page 6

You might also like