static void Main(string[] args) { string[] inputs; inputs = Console.ReadLine().Split(' '); int N = int.Parse(inputs[0]); // the total number of nodes in the level, including the gateways int L = int.Parse(inputs[1]); // the number of links int E = int.Parse(inputs[2]); // the number of exit gateways Skynet network = new Skynet(N); for (int i = 0; i < L; i++) { inputs = Console.ReadLine().Split(' '); int N1 = int.Parse(inputs[0]); // N1 and N2 defines a link between these nodes int N2 = int.Parse(inputs[1]); Skynet.CreateLink(N1, N2); } for (int i = 0; i < E; i++) { int EI = int.Parse(Console.ReadLine()); // the index of a gateway node Skynet.ToGateway(EI); } // game loop while (true) { int SI = int.Parse(Console.ReadLine()); // The index of the node on which the Skynet agent is positioned this turn //Skynet.CalculateDistance(network[SI], 0); var link = Skynet.CutLink(SI); Console.WriteLine("{0} {1}", link.Item1, link.Item2); } }
static void Main(string[] args) { string[] inputs = Console.ReadLine().Split(' '); //Console.Error.WriteLine(string.Join(" ", inputs)); int N = int.Parse(inputs[0]); // the total number of nodes in the level, including the gateways int L = int.Parse(inputs[1]); // the number of links int E = int.Parse(inputs[2]); // the number of exit gateways Skynet nodes = new Skynet(N); for (int i = 0; i < L; i++) { inputs = Console.ReadLine().Split(' '); int N1 = int.Parse(inputs[0]); // N1 and N2 defines a link between these nodes int N2 = int.Parse(inputs[1]); nodes.CreateLink(nodes[N1], nodes[N2]); } for (int i = 0; i < E; i++) { int EI = int.Parse(Console.ReadLine()); // the index of a gateway node nodes.ToGateway(nodes[EI]); } while (true) { int SI = int.Parse(Console.ReadLine()); // The index of the node on which the Skynet agent is positioned this turn Tuple <Skynet.Node, Skynet.Node> link = nodes.SeverLink(SI); Console.WriteLine("{0} {1}", link.Item1.Val, link.Item2.Val); } }