National Yang Ming Chiao Tung University 2024 Team Selection Programming Contest
A. Trip Counting I
time limit per test
3 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Example
Input
3 0
Output
6

B. Trip Counting II
time limit per test
4 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Examples
Input
4 4
1 2
2 3
3 4
1 4
Output
8
Input
4 6
1 2
1 3
1 4
2 3
2 4
3 4
Output
24

C. Trip Counting III
time limit per test
2 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Examples
Input
5 5
1 2
2 3
3 4
4 5
1 5
Output
10
Input
4 6
1 2
1 3
1 4
2 3
2 4
3 4
Output
0

D. Rearrangement
time limit per test
2 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Examples
Input
3 2
4 1
5 8
4 7
Output
9
Input
2 3
1 1 4
5 1 4
Output
10

E. Elimination Game
time limit per test
2 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Example
Input
2
5 2 2 4
10 0 9 7
Output
Yes
No

F. Destroying Monsters
time limit per test
2 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Example
Input
3
3 3
1 2 4
1 3
2 3
2 5
6 7
2 3 6 7 10 13
1 1
3 8
4 6
12 1000000000
2 4
1 5
10 10
7 4
3 8 2 6 1 8 9
7 7
8 9
1 2
3 5
Output
2
4
-1

G. Graph Coloring Problem
time limit per test
6 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Examples
Input
5 6 6
1 5 3
2 5 14
1 2 12
2 4 7
4 3 10
2 3 9
3
9
12
15
1
8
Output
2
3
5
5
1
2
Input
2 1 5
1 2 100
98
99
100
101
102
Output
1
1
2
2
2

H. Points Separation
time limit per test
5 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Examples
Input
4 5
2 0
0 2
0 0
2 2
1 1
2 1
1 3
4 5
-2 0
Output
-1
-1
0.500000000000000
1.802775637731995
1.000000000000000
Input
5 3
2 1
1 0
0 3
1 1
1 2
-1 4
4 0
5 3
Output
0.707106781186548
1.118033988749895
1.802775637731995
Input
1 3
0 0
1 2
2 5
2 4
Output
1.118033988749895
2.692582403567252
2.236067977499790

I. LIS Decrement
time limit per test
2 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Examples
Input
5
1 3 2 5 4
100 2 4 6 5
Output
111
Input
7
7 3 2 1 5 2 1
4 8 4 1 2 3 5
Output
24
Input
4
1 1 1 1
4 5 1 7
Output
0

J. Randomized String Matching Algorithm
time limit per test
7 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Examples
Input
babca
ba
2
Output
436731905
Input
acdacda
cdc
3
Output
389144385
Input
abacbacbabaddcabbcdacba
badbcbcbdbacaa
998244353
Output
110991665
Input
bbbbbbbbb
bbbbb
123456789
Output
1

K. King's Challenge
time limit per test
10 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Example
Input
3
10 4
1000 3
100001 2
Output
504
97002
00001

L. The Bag of Forgotten Coins
time limit per test
2 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Examples
Input
1
1
Output
1
Input
2
1 2
Output
2
Input
3
4 5 3
Output
7

M. The Tale of Professor Alya and the H-Index
time limit per test
2 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Examples
Input
5
6 5 3 1 0
Output
3
Input
10
10 10 10 10 9 8 7 6 5 4
Output
7