SWERC 2021-2022 - Online Mirror (Unrated, ICPC Rules, Teams Preferred)


A. Organizing SWERC
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
3
8 4
9 3
6 7
12
3 10
10 1
10 2
10 3
10 4
3 10
10 5
10 6
10 7
10 8
10 9
1 10
Output
MOREPROBLEMS
93
----------------------------------------------------------------------------------------------------
B. Toys
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
AA
GA
MA
Output
2
AG
AM
Input
TEDDY
HEDWIG
RACCOON
Output
8
AT
CH
CY
DG
DO
ER
IN
OW
Input
BDC
CAA
CE
Output
4
AD
AE
BB
CC
----------------------------------------------------------------------------------------------------
C. European Trip
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 5 2
4 1
2 3
3 1
4 3
2 4
Output
0
Input
4 5 3
1 3
4 2
4 1
2 1
3 4
Output
12
Input
8 20 12
4 3
6 7
5 7
8 2
8 3
3 1
4 7
8 5
5 4
3 5
7 1
5 1
7 8
3 2
4 2
5 2
1 4
4 8
3 6
4 6
Output
35551130
----------------------------------------------------------------------------------------------------
D. Evolution of Weasels
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
8
A
B
B
C
C
A
AA
BB
BB
CC
CC
AA
ABAB
BCBC
ABC
CBA
Output
NO
NO
NO
YES
YES
YES
YES
NO
----------------------------------------------------------------------------------------------------
E. Round Table
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
4
2 3 1 4
5
5 4 3 2 1
7
4 1 6 5 3 7 2
Output
1
10
22
----------------------------------------------------------------------------------------------------
F. Antennas
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
10 2 9
4 1 1 1 5 1 1 1 1 5
1 1 1
1
3 1 3
3 3 1
Output
4
0
2
----------------------------------------------------------------------------------------------------
G. Gastronomic Event
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
5
1 2 2 2
Output
13
Input
10
1 2 3 4 3 2 7 8 7
Output
47
----------------------------------------------------------------------------------------------------
H. Boundary
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
3 5
12 12
314159265 358979323
Output
3 1 2 3
3 1 2 11
2 1 2
----------------------------------------------------------------------------------------------------
I. Ice Cream Shop
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 1
2 5 6
169
Output
7
Input
4 2
1 2 7 8
35 157
Output
15
Input
4 1
272203905 348354708 848256926 939404176
20
Output
2136015810
Input
3 2
1 1 1
300 99
Output
2
----------------------------------------------------------------------------------------------------
J. Training Camp
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
1 2 3
3 1 2
2 3 1
1 0 0
0 0 1
0 0 0
Output
1
Input
4
1 2 3 4
2 1 4 3
3 4 1 2
4 3 2 1
1 1 1 0
0 0 1 0
1 1 0 1
0 0 0 1
Output
2
----------------------------------------------------------------------------------------------------
K. Pandemic Restrictions
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
0 0
5 0
3 3
Output
5.0686143166
Input
-1 0
0 0
1 0
Output
2.0000000000
----------------------------------------------------------------------------------------------------
L. Il Derby della Madonnina
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 2
5 10 15
7 17 29
Output
2
Input
5 1
5 7 8 11 13
3 3 -2 -2 4
Output
3
Input
1 2
3
7
Output
0
----------------------------------------------------------------------------------------------------
M. Bottle Arrangements
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
5 3
1 0
3 2
2 2
4 3
2 1
1 1
0 3
3 2
0 2
0 3
Output
RWRRW
IMPOSSIBLE
WWW
----------------------------------------------------------------------------------------------------
N. Drone Photo
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
2
1 3
4 2
Output
0
Input
2
3 2
4 1
Output
1
Input
3
9 2 4
1 5 3
7 8 6
Output
6
----------------------------------------------------------------------------------------------------
O. Circular Maze
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
5
C 1 180 90
C 5 250 230
C 10 150 140
C 20 185 180
S 1 20 180
6
C 1 180 90
C 5 250 230
C 10 150 140
C 20 185 180
S 1 20 180
S 5 10 0
Output
YES
NO
----------------------------------------------------------------------------------------------------
