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


A. Walking Boy
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
14
100 200 300 400 500 600 700 800 900 1000 1100 1200 1300 1400
12
100 200 300 400 600 700 800 900 1100 1200 1300 1400
13
100 200 300 400 500 600 700 800 900 1100 1200 1300 1400
13
101 189 272 356 463 563 659 739 979 1071 1170 1274 1358
1
42
5
0 1 2 3 4
Output
NO
YES
NO
YES
YES
YES
----------------------------------------------------------------------------------------------------
B. Vittorio Plays with LEGO Bricks
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 0
2 7 11 13
Output
0
Input
4 1
2 7 11 13
Output
3
Input
4 100
2 7 11 13
Output
107
Input
4 3
2 5 8 11
Output
8
----------------------------------------------------------------------------------------------------
C. Library game
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 14
3 7 2 3 10
Output
-
Input
4 10
4 1 6 4
Output
-
----------------------------------------------------------------------------------------------------
D. Teamwork
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 1 1 3
Output
2
1 0 2
2 0 3
Input
1 2 3 5
Output
4
1 0 2
2 0 3
3 0 4
1 2 5
Input
0 1 2 2
Output
0
----------------------------------------------------------------------------------------------------
E. Crossing the Railways
time limit per test: 4 seconds
memory limit per test: 1024 megabytes
input: standard input
output: standard output

Examples
Input
4 3 5 1
1 2 1
3 4 1
2 3 2
3 4 3
Output
0
Input
3 3 12 2
2 10 1
1 6 2
8 12 3
Output
2
Input
8 4 13 2
1 4 1
5 13 1
1 5 2
6 13 2
1 9 3
10 13 3
1 10 4
11 13 4
Output
2
Input
1 1 2 2
1 2 1
Output
-1
----------------------------------------------------------------------------------------------------
F. Train Splitting
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
5 9
1 2
1 3
1 4
1 5
2 3
2 4
2 5
3 4
3 5
3 3
1 2
3 1
2 3
Output
4
1 2 3 1 4 2 2 4 3
3
2 3 1
----------------------------------------------------------------------------------------------------
G. Another Wine Tasting Event
time limit per test: 0.5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
RWWRRRWWW
Output
2
Input
1
R
Output
0
----------------------------------------------------------------------------------------------------
H. Beppa and SwerChat
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
5
1 4 2 5 3
4 5 1 2 3
6
1 2 3 4 5 6
1 2 3 4 5 6
8
8 2 4 7 1 6 5 3
5 6 1 4 8 2 7 3
1
1
1
Output
2
0
4
0
----------------------------------------------------------------------------------------------------
I. Spinach Pizza
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
0 0
6 1
5 3
1 4
Output
-
Input
6
0 0
2 0
3 2
2 4
0 4
-1 2
Output
-
Input
7
0 0
2 0
5 2
4 5
1 5
-1 4
-1 2
Output
-
----------------------------------------------------------------------------------------------------
J. Italian Data Centers
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 3 0
1 2 3
1 2
2 3
3 1
Output
1
Input
3 3 1
1 2 3
1 2
2 3
3 1
Output
2
Input
3 3 2
1 2 1
1 2
2 3
3 1
Output
3
Input
8 14 100
3 3 2 2 1 2 2 1
2 7
1 5
7 8
4 6
2 8
1 8
2 6
6 7
1 6
1 4
3 5
1 3
4 5
5 7
Output
53
----------------------------------------------------------------------------------------------------
K. Uniform Chemistry
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 3
1 1 1
Output
1.0 1.0 1.0
Input
3 3
1 1 2
Output
0.5 0.5 1.0
Input
3 3
1 1 1
Output
0.625 0.625 0.625
Input
100 7
1 2 4 8 16 32 64
Output
0.178593469 0.179810455 0.182306771
0.187565366 0.199300430 0.229356322
0.348722518
----------------------------------------------------------------------------------------------------
L. Controllers
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
8
+-+---+-
5
2 1
10 3
7 9
10 10
5 3
Output
YES
NO
NO
NO
YES
Input
6
+-++--
2
9 7
1 1
Output
YES
YES
Input
20
+-----+--+--------+-
2
1000000000 99999997
250000000 1000000000
Output
NO
YES
----------------------------------------------------------------------------------------------------
M. Parmigiana With Seafood
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
1 2
1 3
1 4
Output
4
Input
5
1 5
5 3
3 4
4 2
Output
3
----------------------------------------------------------------------------------------------------
N. Count Permutations
time limit per test: 5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
<
Output
0.0000000000
Input
3
<>
Output
1.0000000000
Input
5
><<<
Output
2.0000000000
Input
10
<><<<<<>>
Output
9.8281364842
----------------------------------------------------------------------------------------------------
