TopCoder

User's AC Ratio

54.5% (6/11)

Submission's AC Ratio

29.4% (15/51)

Tags

Description

Input Format

Output Format

Sample Input 1

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

Sample Output 1

2

Sample Input 2

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

Sample Output 2

-1

Sample Input 3

8 11
1 2
2 1
2 3
3 4
3 8
4 1
4 5
5 6
5 7
6 7
6 8
1 8

Sample Output 3

1

Hints

Problem Source

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

Subtasks

No. Testdata Range Constraints Score
1 0~2 範例測資 0
2 3~12 $m=n-1$,且存在某個點 $r$ 滿足從 $r$ 出發可以到達 $G$ 上的其他點 4
3 13~21 $G$ 不包含任何環 (cycle) 24
4 22~34 $n\leq100,m\leq 1000$ 31
5 0~50 無額外限制 41

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 1500 1048576 65536 1 5
1 1500 1048576 65536 1 5
2 1500 1048576 65536 1 5
3 1500 1048576 65536 2 5
4 1500 1048576 65536 2 5
5 1500 1048576 65536 2 5
6 1500 1048576 65536 2 5
7 1500 1048576 65536 2 5
8 1500 1048576 65536 2 5
9 1500 1048576 65536 2 5
10 1500 1048576 65536 2 5
11 1500 1048576 65536 2 5
12 1500 1048576 65536 2 5
13 1500 1048576 65536 3 5
14 1500 1048576 65536 3 5
15 1500 1048576 65536 3 5
16 1500 1048576 65536 3 5
17 1500 1048576 65536 3 5
18 1500 1048576 65536 3 5
19 1500 1048576 65536 3 5
20 1500 1048576 65536 3 5
21 1500 1048576 65536 3 5
22 1500 1048576 65536 4 5
23 1500 1048576 65536 4 5
24 1500 1048576 65536 4 5
25 1500 1048576 65536 4 5
26 1500 1048576 65536 4 5
27 1500 1048576 65536 4 5
28 1500 1048576 65536 4 5
29 1500 1048576 65536 4 5
30 1500 1048576 65536 4 5
31 1500 1048576 65536 4 5
32 1500 1048576 65536 4 5
33 1500 1048576 65536 4 5
34 1500 1048576 65536 4 5
35 1500 1048576 65536 5
36 1500 1048576 65536 5
37 1500 1048576 65536 5
38 1500 1048576 65536 5
39 1500 1048576 65536 5
40 1500 1048576 65536 5
41 1500 1048576 65536 5
42 1500 1048576 65536 5
43 1500 1048576 65536 5
44 1500 1048576 65536 5
45 1500 1048576 65536 5
46 1500 1048576 65536 5
47 1500 1048576 65536 5
48 1500 1048576 65536 5
49 1500 1048576 65536 5
50 1500 1048576 65536 5