TopCoder

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

User's AC Ratio

91.7% (33/36)

Submission's AC Ratio

35.2% (64/182)

Tags

Description

Input Format

Output Format

Sample Input 1

2 18
1 2
3 3
3 3
3
2 3

Sample Output 1

0

Sample Input 2

2 29
1 2
3 3
3 3
3
2 3

Sample Output 2

3

Sample Input 3

2 30
1 2
3 3
3 3
3
2 3

Sample Output 3

6

Sample Input 4

2 10
1 2
3 3
3 3
3
2 3

Sample Output 4

-1

Hints

Problem Source

110 學年度全國資訊學科能力競賽
測資來源:TWPCA GitHub

Subtasks

No. Testdata Range Constraints Score
1 0~3 範例測資。 0
2 4~23 $c \le 20, T \le 30000$ 11
3 24~53 $T \le 30000$ 38
4 54~73 無額外限制。 51

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 1000 1048576 65536 1
1 1000 1048576 65536 1
2 1000 1048576 65536 1
3 1000 1048576 65536 1
4 1000 1048576 65536 2
5 1000 1048576 65536 2
6 1000 1048576 65536 2
7 1000 1048576 65536 2
8 1000 1048576 65536 2
9 1000 1048576 65536 2
10 1000 1048576 65536 2
11 1000 1048576 65536 2
12 1000 1048576 65536 2
13 1000 1048576 65536 2
14 1000 1048576 65536 2
15 1000 1048576 65536 2
16 1000 1048576 65536 2
17 1000 1048576 65536 2
18 1000 1048576 65536 2
19 1000 1048576 65536 2
20 1000 1048576 65536 2
21 1000 1048576 65536 2
22 1000 1048576 65536 2
23 1000 1048576 65536 2
24 1000 1048576 65536 3
25 1000 1048576 65536 3
26 1000 1048576 65536 3
27 1000 1048576 65536 3
28 1000 1048576 65536 3
29 1000 1048576 65536 3
30 1000 1048576 65536 3
31 1000 1048576 65536 3
32 1000 1048576 65536 3
33 1000 1048576 65536 3
34 1000 1048576 65536 3
35 1000 1048576 65536 3
36 1000 1048576 65536 3
37 1000 1048576 65536 3
38 1000 1048576 65536 3
39 1000 1048576 65536 3
40 1000 1048576 65536 3
41 1000 1048576 65536 3
42 1000 1048576 65536 3
43 1000 1048576 65536 3
44 1000 1048576 65536 3
45 1000 1048576 65536 3
46 1000 1048576 65536 3
47 1000 1048576 65536 3
48 1000 1048576 65536 3
49 1000 1048576 65536 3
50 1000 1048576 65536 3
51 1000 1048576 65536 3
52 1000 1048576 65536 3
53 1000 1048576 65536 3
54 1000 1048576 65536 4
55 1000 1048576 65536 4
56 1000 1048576 65536 4
57 1000 1048576 65536 4
58 1000 1048576 65536 4
59 1000 1048576 65536 4
60 1000 1048576 65536 4
61 1000 1048576 65536 4
62 1000 1048576 65536 4
63 1000 1048576 65536 4
64 1000 1048576 65536 4
65 1000 1048576 65536 4
66 1000 1048576 65536 4
67 1000 1048576 65536 4
68 1000 1048576 65536 4
69 1000 1048576 65536 4
70 1000 1048576 65536 4
71 1000 1048576 65536 4
72 1000 1048576 65536 4
73 1000 1048576 65536 4