As information travels farther away from its source, spreaders tend to select facts and offer their own interpretations. In other words, information becomes biased as it’s retold from person to person. This phenomenon is called Information Distortion.
A sensational story has been brought to the village by a person, who is regarded as the origin of the story. The story is then gossiped about from person to person. People spread the story to whoever they know. Every time when the story is passed to the next person, the correctness will shrink according to the closeness of the two people. Therefore, for each story receiver, different propagation paths may lead to different final correctness of the story.
The social network in this village is represented as a graph, where the nodes stand for the people, and the edges stand for the closeness of two people. Given the connected graph, we want to know: for each person in the village, which path brings the most reliable story (aka, the story with the highest correctness).
You can use log
to calculate the final correctness for each node.
EX: If a story travels through0 -> 2 -> 1
in the above illustration, the final correctness is 0.9 * 0.8
L
with round(L*100.0)/100.0
before summing them up.Syntax
Include library to use "log" and "abs".
#include <bits/stdc++.h>
#include <cstdlib>
Get the log value,temp
, and round it to the 2nd decimal places. Get the absolute value.
abs ( round(log2(temp)*100) / 100.0 )
An integer N represents the number of nodes, 2 ≤ N ≤ 100
An integer R is the index of the origin node, 0 ≤ R ≤ N-1
An N*N adjacency matrix represents the graph
The origin is: %ORIGIN
Path(%ORIGIN,%RECEIVER): %ORIGIN -> ... -> ... -> %RECEIVER