#P4252. [NOI2006] 聪明的导游

    ID: 3160 远端评测题 1000ms 250MiB 尝试: 0 已通过: 0 难度: 9 上传者: 标签>2006NOI 系列提交答案Special JudgeO2优化

[NOI2006] 聪明的导游

Description

Xiao Jia recently became obsessed with being a tour guide and keeps thinking about taking tourists to visit various scenic spots. It so happens that NOI is being held in M City, and there are many visitors. Many friends introduced people who need a tour guide to Xiao Jia.

There are nn famous scenic spots in M City, numbered from 11 to nn. Some pairs of scenic spots are connected by bidirectional roads. Xiao Jia can gather the tourists at any scenic spot to start the tour and can also end the tour at any scenic spot. However, the tourists do not want to visit a place they have already visited. Therefore, Xiao Jia cannot pass through the same scenic spot more than once.

Xiao Jia hopes you can help design a plan: choose a feasible route that visits as many scenic spots as possible.

Input Format

The input files are guide1.in ~ guide10.in. The first line contains two integers n,mn, m, the number of scenic spots and the number of roads. The next mm lines each contain two integers a,ba, b, indicating there is a bidirectional road between scenic spot aa and scenic spot bb.

Output Format

You need to write the answers to guide1.out ~ guide10.out, where guide?.out is the answer corresponding to guide?.in. The first line outputs pp, the number of scenic spots on your path. Then output pp lines, each containing one integer, in order, representing each scenic spot on your path.

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

4
1
2
4
5

Hint

[Explanation] This is an output-only problem. You do not need to submit any source code; just place your output files in the same directory as the corresponding *.in files.

[Sample Explanation] The problem may have multiple correct answers. This sample has 4 solutions. You only need to output any one of them.

::cute-table{tuack}

Solution 11 Solution 22 Solution 33 Solution 44
4
1 3
2
4 5 4 5
5 4 5 4

[Scoring Method] Your score is determined by the difference between your answer and the official answer. Suppose your answer is correct and the number of scenic spots visited is xx, and our result is ans\mathit{ans}. Then your score is computed as follows:

::cute-table{tuack}

Score Condition Score Condition
1212 x>ansx > ans 55 xans×0.93x \leq ans \times 0.93
1010 x=ansx = ans 44 xans×0.9x \leq ans \times 0.9
99 xans1x \leq ans - 1 33 xans×0.8x \leq ans \times 0.8
88 xans2x \leq ans - 2 22 xans×0.7x \leq ans \times 0.7
77 xans3x \leq ans - 3 11 xans×0.5x \leq ans \times 0.5
66 xans×0.95x \leq ans \times 0.95 00

If multiple conditions are satisfied, take the highest score.

Translated by ChatGPT 5