The longest path solves the problem of maximizing the output of ethylene in LV stages [GTNH] Gray Technology: New Vision

This tutorial is set by the author to use the CC By-NC-SA protocol.

GTNH version: 2.2.0.0

For the first time I came into contact with GT, please correct me wrong

The most needed to solve the production of ethylene when you just enter the LV stage. Considering that some output is often maximized in the later period, there is this

Target:

Maximize ethylene output of unit crude oil in the LV stage

analyze:

Crude oil->

Sulfur refining gas-> oil refining gas

Steamed oil refining gas

Steamed oil refining gas

Remake the refining gas

Sulfur and Pack -> Petroleum Oil

Steaming Petroleum

Steamed Pack

Steamed Petroleum

Sulfur -containing light fuel -> Lulin fuel

Steaming and low fuel

Steamed light fuel

Steamed light fuel

Sulfur containing heavy fuel -> heavy fuel

Steaming and heavy fuel

Medium steaming fuel

Steaming fuel

Taking this type .... Finally, the product of ethylene is temporarily considering hydrogenation from the product of the product of the hydrogen hydrogen in the light steaming and steaming the hydrogen hydrogen in the light steam.

Note: This is LV, no cracking machine

Abstract is a one -to -ring (DAG).

topic:

Now give a node K i , find k i1 to K i2 the longest path

enter:

N // Border number, the following is the point of edge of the point of each side

K i1 k i2 z // Two nodes K i1 k i2

..........

Because the amount of data is small for the time being, the data is not initialized, and I can manually make a watch (whether there is a folding list, this is too long)

71

0 1 0.83

0 2 2.50

0 3 1.00

0 4 3.33

1 5 1.00

2 6 1.00

3 7 1.00

4 8 1.00

5 9 1.25

5 10 1.25

5 11 1.25

5 21 1.25

5 22 1.25

5 23 1.25

6 12 1.25

6 13 1.25

6 14 1.25

6 24 1.25

6 25 1.25

6 26 1.25

7 15 1.25

7 16 1.25

7 17 1.25

7 27 1.25

7 27 1.25

7 27 1.25

8 18 1.25

8 19 1.25

8 20 1.25

8 28 1.25

8 29 1.25

8 30 1.25

9 33 10.00

10 33 5.00

11 33 3.33

12 7 6.66

12 8 13.33

12 33 5.00

13 33 2.86

13 7 10.00

13 8 20.00

14 33 2.00

14 7 20.00

14 8 40.00

15 33 20.00

15 6 2.50

15 8 6.66

16 33 6.66

16 6 4.00

16 8 10.00

17 33 4.00

17 6 10.00

17 8 20.00

18 33 20.00

18 6 20.00

18 7 3.33

19 33 13.33

19 6 5.00

19 7 5.00

20 33 6.66

20 6 8.00

20 7 10.00

27 6 1.25

28 6 2.00

29 6 5.00

30 6 10.00

30 7 1.66

31 6 2.50

31 7 2.50

32 6 4.00

32 7 5.00

0 crude oil

1 Sulfur refining gas

2 containing sulfur and petroleum

3 Sulfur containing light fuel

4 Sulfur containing heavy fuel

5 refining gas

6 Pack

7 light fuel

8 heavy fuel

9 light steam refining gas

Steamed refining gas in 10

11 Remake Refining Gas

12 light steaming petroleum

13 Steamed PetroChina

14 Steamed Petroleum Oil

15 light steaming and low fuel

16 Steamed light fuel

17 Steaming light fuel

18 light steaming heavy fuel fuel

19 of 19 steaming fuel

20 heavy steaming and heavy fuel

21 Light hydrogen refining gas

22 hydrogen refining gas

23 heavy hydrogen refining gas

24 Light hydrogen oil brain oil

25 Hydrogen PetroChina 26 Reverse Hydrogen Petroleum Oil

27 Light hydrogen and low fuel

28 Hydrogen low fuel fuel

29 heavy hydrogen light fuel

30 light hydrogen heavy fuel fuel

31 Hydrogen heavy fuel

32 heavy hydrogen heavy fuel

33 ethylene

Code (basically only written subject): high emotional quotient: core code low emotional quotient: lazy to optimize

#Include 

using namespace std;

#Define Maxa 100000

int n;

int Step [maxa], vis [maxa];

double ans [maxa];

// Chain front star;

int Tot = 1;

int head [maxa], ver [maxa], next [maxa];

double edge [maxa];

void add (int x, int y, double z) {

Ver [++ touch] = y, edge [touch] = z;

Next [touch] = head [x], head [x] = tot;

};

void dfs (int x) {

Vis [x] = 1;

For (int i = head [x]; i; i = next [i]) {

Int y = ver [i];

Double z = edge [i];

If (ANS [Y]

// Printf ("Path of%D is updated to%d to%d to%d

", Y, x, y);

Ans [y] = Ans [x]/z;

Step [y] = x;

If (vis [y]) {// Only updated the edge of the past, optimization;

Dfs (y);

}};

};

};

int Main () {

Scanf ("%d", & n);

For (int i = 1; i <= n; ++ i) {

Int x, y;

Double Z;

Scanf ("%d%d%lf", & x, & y, & z);

Add (x, y, z);

};

ANS [0] = 1;

For (int x = 0; x

Dfs (x);

};

// K is the corresponding value of ethylene;

For (int i = 33; i; i = STEP [i]) {

Printf ("%d <-", i);

}

Printf ("%d", 0);

Return 0;

};

The output is:

33 <- 11 <- 5 <- 1 <- 0 0

Update