CAT 2026 Final
A. BFS = DFS?
time limit per test
2 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Example
Input
4
1 3 2 4
Output
2

B. Function Sum
time limit per test
2 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Example
Input
3 29 3 2
Output
18

C. Making a Motif
time limit per test
2 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Examples
Input
2 4
1001
??0?
10??
Output
2
0001
1000
Input
2 4
1001
?10?
10??
Output
-1

D. Coin Change
time limit per test
2 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Examples
Input
6 2
110 180 200 130 9 9
Output
3 10
1 3
Input
3 3
200 1 0
Output
2 1
1 2 3

E. Painting a Wall
time limit per test
2 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Examples
Input
6 5
01101
1 2
2 3
6 6
3 4
4 5
Output
3
Input
1 2
01
1 1
1 1
Output
1

F1. Eating Brownies (Easy)
time limit per test
2 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Example
Input
3 4 1
1001
1111
0011
Output
3
2 4

F2. Eating Brownies (Hard)
time limit per test
2 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Examples
Input
3 4 1
1001
1111
0011
Output
3
2 4
Input
3 4 2
1001
1111
0011
Output
2
3 4
2 2
Input
3 3 2
101
010
101
Output
1
1 3
3 1