#P5421. [CTSC2016] 科学考察队

    ID: 6148 远端评测题 2000ms 500MiB 尝试: 0 已通过: 0 难度: (无) 上传者: 标签>2016提交答案Special JudgeO2优化CTSC/CTS

[CTSC2016] 科学考察队

Background

This is an output-only problem.

Problem Description

This year happens to be Youth Day on May 4th. On such a great day, the young explorer Niuniu leads his scientific expedition team to explore a primeval forest.

Before the expedition starts, Niuniu obtains a map of the forest. There are nn gathering points in the forest, numbered from 11 to nn. Between these gathering points, there are mm paths, numbered from 11 to mm. Each path starts at one gathering point and ends at another gathering point.

To improve the expedition efficiency, Niuniu divides his team into pp squads, and each squad can independently complete some tasks. They agree to start from the gathering point numbered SS and finally meet at the gathering point numbered TT. During the expedition, they will face many difficulties. For example, team members can slowly descend from the top of a cliff to the bottom, but cannot climb directly from the bottom to the top. Therefore, all paths in the input are one-way.

When a squad moves along a path, it records various information and testdata on that path. However, some paths need to be opened up by the expedition team themselves. Opening a path consumes certain materials and produces some cost. Due to limited equipment, the equipment assigned to each squad may be different, so on some difficult paths, some squads may be unable to pass because they lack enough equipment. However, by allocating equipment reasonably, Niuniu ensures that every squad can successfully reach the gathering point numbered TT.

After all squads arrive at point TT and meet, Niuniu will aggregate all information and testdata. The total value of this information and testdata is the total revenue of this scientific expedition. If multiple squads pass through the same path, since the data they record about this path is duplicated, its value is counted only once. The cost spent on opening paths is the total expenditure of this expedition. Similarly, even if multiple squads pass through the same path that needs to be opened, this path only needs to be opened once.

Now, Niuniu hopes to design reasonable action routes for his pp squads so that the value of total revenue minus total expenditure is maximized.

Input Format

The input files expedition1.in~expedition10.in are provided in the problem directory.

For each input dataset:

The first line contains 55 integers n,m,p,S,Tn, m, p, S, T, with meanings as described above.

The next 2m2m lines describe the paths, with every two lines describing one path.

On the first line of each path, there are three integers u,v,wu, v, w, indicating that the path starts at uu and ends at vv. If w<0w < 0, it means the data value on this path is ww, and it does not need to be opened. If w0w \leq 0, it means the data value on this path is 00, and the cost to open it is w-w.

On the second line of each path, the first integer is kk, indicating the number of squads that cannot pass this path. Then follow kk distinct integers, indicating the indices of these kk squads.

Output Format

The output files expedition1.out~expedition10.out are provided in the problem directory.

For each input dataset, you need to output pp lines in order. The ii-th line describes the action sequence of squad ii.

The first number on each line is kk, indicating how many paths this squad has traveled in total. Then follow kk numbers, indicating the indices of the paths this squad travels through in order when going from SS to TT.

4 4 2 1 4
1 3 3
1 2
1 2 5
0
2 3 -2
1 1 
3 4 1
0
2 1 4
3 2 3 4

Hint

Explanation for Sample 1

There are 44 gathering points and 44 paths on the map. The paths that squad 11 can pass are 1,2,41, 2, 4, and the paths that squad 22 can pass are 2,3,42, 3, 4. In the end, squad 11 passes paths 1,41, 4 in order, and squad 22 passes paths 2,3,42, 3, 4 in order. The total revenue obtained is 3+5+1=93 + 5 + 1 = 9. The total expenditure is 22. The value of total revenue minus total expenditure is 92=79 - 2 = 7.

Scoring

Each test point is scored independently. For each test point, you may also receive partial credit.

For each test point, we provide 1010 scoring parameters a1,a2,a3,,a9,a10a_1, a_2, a_3, \dots, a_9, a_{10}. If your output is invalid, you get 00 points. Otherwise, in your solution, if the expedition’s total revenue is wuserw_{user}, and there exists a largest ii such that wuseraiw_{user} \geq a_{i}, then you get ii points.

All scoring parameter files expedition1.ans~expedition10.ans are provided in the problem directory. Each scoring parameter file has 1010 lines. On the ii-th line there is a non-negative integer indicating aia_i.

Input Data Download

Download link

Translated by ChatGPT 5