CAT 2026 Preliminary Batch 2 (Upsolving)
A. Bridge Day
time limit per test
2 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Examples
Input
3 7
31 28 31
1 1
3 1
28 1
29 1
30 1
1 2
30 3
Output
YA
Input
6 8
31 28 31 30 31 30
1 1
17 2
18 2
21 3
3 4
1 5
27 5
31 5
Output
TIDAK

B. Playing Games
time limit per test
2 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Examples
Input
3 11
2 1
5 100
3 10
Output
4
Input
5 10
5 1
6 1
7 1
8 1
9 1
Output
1
Input
5 4
5 1
6 1
7 1
8 1
9 1
Output
0

C. Prim's Problem
time limit per test
2 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Examples
Input
3 2
1 2 10
1 3 100
Output
0
Input
3 2
1 2 10
2 3 30
Output
-1
Input
3 3
1 2 10
1 3 100
2 3 30
Output
1

D. Isomorphic Operations
time limit per test
4 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Example
Input
8 7
ababcbdb
3 1 3 3
3 1 6 3
1 5 a
3 1 3 3
3 3 4 2
2 5 8
3 3 4 2
Output
TIDAK
YA
YA
YA
TIDAK