# TopCoder

Caido
$\mathbb{W}\mathcal{aimai}\sim$

86.2% (25/29)

16.2% (31/191)

# Description

「你是鄭教授！」
「不，我是鄭笨蛋，你才是鄭教授。」

# Input Format

$2 \leq k_i \leq n, \sum_{i=1} ^ m k_i \leq 4 \times 10 ^ 5$

3 1
3 3 1 2 3

3

5 3
2 3 1 4
3 5 2 3 5
3 2 1 2 3

7

4 1
3 5 2 3 4

-1

# Problem Source

No. Testdata Range Constraints Score
1 0~2 範例測資 0
2 3~7 $m = 1$ 6
3 8~17 $m = n - 1, \forall 1 \leq i \leq m, k_i = 2$ 16
4 8~28 $\forall 1 \leq i \leq m, k_i = 2$ 20
5 0~38 無其他限制 58

# Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 1000 262144 65536 1 5
1 1000 262144 65536 1 5
2 1000 262144 65536 1 5
3 1000 262144 65536 2 5
4 1000 262144 65536 2 5
5 1000 262144 65536 2 5
6 1000 262144 65536 2 5
7 1000 262144 65536 2 5
8 1000 262144 65536 3 4 5
9 1000 262144 65536 3 4 5
10 1000 262144 65536 3 4 5
11 1000 262144 65536 3 4 5
12 1000 262144 65536 3 4 5
13 1000 262144 65536 3 4 5
14 1000 262144 65536 3 4 5
15 1000 262144 65536 3 4 5
16 1000 262144 65536 3 4 5
17 1000 262144 65536 3 4 5
18 1000 262144 65536 4 5
19 1000 262144 65536 4 5
20 1000 262144 65536 4 5
21 1000 262144 65536 4 5
22 1000 262144 65536 4 5
23 1000 262144 65536 4 5
24 1000 262144 65536 4 5
25 1000 262144 65536 4 5
26 1000 262144 65536 4 5
27 1000 262144 65536 4 5
28 1000 262144 65536 4 5
29 1000 262144 65536 5
30 1000 262144 65536 5
31 1000 262144 65536 5
32 1000 262144 65536 5
33 1000 262144 65536 5
34 1000 262144 65536 5
35 1000 262144 65536 5
36 1000 262144 65536 5
37 1000 262144 65536 5
38 1000 262144 65536 5