Helvetic Coding Contest 2017 online mirror (teams allowed, unrated)


A. Heidi and Library (easy)
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 80
1 2 2 1
Output
2
Input
4 1
1 2 2 1
Output
3
Input
4 2
1 2 3 1
Output
3
----------------------------------------------------------------------------------------------------
B. Heidi and Library (medium)
time limit per test: 10 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 100
1 2 2 1
Output
2
Input
4 1
1 2 2 1
Output
3
Input
4 2
1 2 3 1
Output
3
----------------------------------------------------------------------------------------------------
C. Heidi and Library (hard)
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 80
1 2 2 1
1 1 1 1
Output
2
Input
4 1
1 2 2 1
1 1 1 1
Output
3
Input
4 2
1 2 3 1
1 1 1 1
Output
3
Input
7 2
1 2 3 1 1 1 2
1 10 1 0 0 0 0
Output
13
----------------------------------------------------------------------------------------------------
D. Marmots (easy)
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
92 100 99 109 93 105 103 106 101 99 ... (input is truncated)
28 180 147 53 84 80 180 85 8 16 ... (input is truncated)
Output
poisson
uniform
----------------------------------------------------------------------------------------------------
E. Marmots (medium)
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

No test samples are available for this problem
----------------------------------------------------------------------------------------------------
F. Marmots (hard)
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

No test samples are available for this problem
----------------------------------------------------------------------------------------------------
G. Fake News (easy)
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
abcheaibcdi
Output
YES
Input
hiedi
Output
NO
----------------------------------------------------------------------------------------------------
H. Fake News (medium)
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
Output
hHheidi Hei
Input
4
Output
bbbba ba
Input
6
Output
aaabb ab
----------------------------------------------------------------------------------------------------
I. Fake News (hard)
time limit per test: 5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
aa
abcd
ccc
abcc
Output
5
10
14
12
----------------------------------------------------------------------------------------------------
J. Send the Fool Further! (easy)
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
0 1 4
0 2 2
2 3 3
Output
5
Input
6
1 2 3
0 2 100
1 4 2
0 3 7
3 5 10
Output
105
Input
11
1 0 1664
2 0 881
3 2 4670
4 2 1555
5 1 1870
6 2 1265
7 2 288
8 7 2266
9 2 1536
10 6 3378
Output
5551
----------------------------------------------------------------------------------------------------
K. Send the Fool Further! (medium)
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
9 3
0 1 1
0 2 1
1 3 2
1 4 2
1 5 2
2 6 3
2 7 3
2 8 3
Output
15
Input
9 5
0 1 1
0 2 1
1 3 2
1 4 2
1 5 2
2 6 3
2 7 3
2 8 3
Output
17
Input
11 6
1 0 7932
2 1 1952
3 2 2227
4 0 9112
5 4 6067
6 0 6786
7 6 3883
8 4 7137
9 1 2796
10 5 6200
Output
54092
----------------------------------------------------------------------------------------------------
L. Send the Fool Further! (hard)
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
0 1 10
0 2 20
Output
15
Input
4
0 1 3
0 2 9
0 3 27
Output
13
Input
7
0 1 3
0 5 7
1 2 2
1 3 1
1 4 5
5 6 8
Output
400000019
Input
11
1 0 6646
2 0 8816
3 2 9375
4 2 5950
5 1 8702
6 2 2657
7 2 885
8 7 2660
9 2 5369
10 6 3798
Output
153869806
Input
6
0 1 8
0 2 24
1 3 40
1 4 16
4 5 8
Output
39
----------------------------------------------------------------------------------------------------
M. April Fools' Problem (easy)
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
8 5
1 1 1 1 1 1 1 1
Output
5
Input
10 3
16 8 2 4 512 256 32 128 64 1
Output
7
Input
5 1
20 10 50 30 46
Output
10
Input
6 6
6 6 6 6 6 6
Output
36
Input
1 1
100
Output
100
----------------------------------------------------------------------------------------------------
N. April Fools' Problem (medium)
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
8 4
3 8 7 9 9 4 6 8
2 5 9 4 3 8 9 1
Output
32
----------------------------------------------------------------------------------------------------
O. April Fools' Problem (hard)
time limit per test: 10 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
8 4
3 8 7 9 9 4 6 8
2 5 9 4 3 8 9 1
Output
32
----------------------------------------------------------------------------------------------------
