National Yang Ming Chiao Tung University 2025 Team Selection Programming Contest
A. Angle Problem
time limit per test
3 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Example
Input
5 2
0 0
1 0
0 1
-1 0
0 -1
1 3 0 2
2 5 1 2
Output
26.565051177
45.000000000

B. Binary Palindromes
time limit per test
2 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Example
Input
4
3 3
100
010
6 3
101101
101
2 3
01
001
4 1
1000
1
Output
2
15
1
4

C. Chess Pieces
time limit per test
2 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Example
Input
4
1 0 0 1 -1 0
1 0 0 -1 -1 0
3 1 4 1 5 9
2 7 1 8 2 8
0 0 1 1 2 2
0 0 2 2 1 1
0 0 -1 3 1 5
10 10 13 9 9 5
Output
Yes
No
No
Yes

D. Data Transmission
time limit per test
2 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Example
Input
6 3
1 2
1 5
3 4
2 3
1 6
6 5 2 4
1 6 2 5
4 1 3 6
Output
6
4
5

E. Echoes on the Endless Line
time limit per test
2 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Examples
Input
3 2 4 5
4 5 6
1 10
Output
1 5
1 5
Input
5 4 1 3
1 3 5 6 9
2 4 7 8
Output
1 3
2 5
2 4
2 5

F. Forbidden Spell Sequence
time limit per test
3 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Example
Input
3 2
2 a b
3 b c d
Output
301

G. Graph Orientation
time limit per test
2 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Examples
Input
6 5
5 4 8 4 1 2
1 5
3 5
5 6
2 6
6 4
Output
3
5 1
5 3
5 6
6 2
6 4
Input
4 4
6 9 8 4
1 2
2 3
3 4
4 1
Output
13
2 1
2 3
4 3
4 1

H. Huge Subsets
time limit per test
2 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Example
Input
3
4
1 2 3 4
1
1000000000000000000
3
6 6 6
Output
1 1 1 10
1000000000000000000
6 12 18

I. Ice Sliding
time limit per test
3 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Examples
Input
3 3
...
.#.
...
1
1 1 3 3
Output
5
Input
3 5
....#
#....
.....
2
2 2 1 1
1 1 3 5
Output
-1
13

J. Jigsaw of Perfect Squares
time limit per test
2 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Examples
Input
3
2 3 6
Output
YES
Input
6
4 4 4 4 4 4
Output
NO

K. Karl's Dormitory Allocation
time limit per test
2 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Examples
Input
5 2
10 3 7 6 2
Output
3 3 3
Input
5 4
100 20 60 40 50
Output
6 24 0

L. Lantern Festival
time limit per test
2 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Examples
Input
7
1 0 1 1 0 0 1
Output
4
Input
5
0 1 0 0 1
Output
2

M. Median Replacement
time limit per test
2 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Example
Input
3
3
1 2 3
5
3 2 4 2 5
6
10 10 10 10 10 10
Output
0 1 4
0 1 4 6 166374068
0 0 0 0 0 0