Ejemplo n.º 1
0
    private static void Main()
    {
        var output             = new StringBuilder();
        int remainingTestCases = FastIO.ReadNonNegativeInt();

        while (remainingTestCases-- > 0)
        {
            int cityCount = FastIO.ReadNonNegativeInt();
            var edges     = new List <Edge>(capacity: 2 * cityCount);

            for (int c = 0; c < cityCount; ++c)
            {
                FastIO.ConsumeString(); // Discard city name.

                int neighborCount = FastIO.ReadNonNegativeInt();
                for (int n = 0; n < neighborCount; ++n)
                {
                    edges.Add(new Edge(
                                  sourceCity: c,
                                  destinationCity: FastIO.ReadNonNegativeInt() - 1,
                                  cost: FastIO.ReadNonNegativeInt()));
                }
            }

            output.Append(
                BLINNET.Solve(cityCount, edges));
            output.AppendLine();
        }

        Console.Write(output);
    }