Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
            int T = int.Parse(Console.ReadLine());

            for (int i = 0; i < T; i++)
            {
                string   input   = Console.ReadLine();
                string[] spl     = input.Split(' ');
                int      width   = int.Parse(spl[0]);
                int      height  = int.Parse(spl[1]);
                int      cabbage = int.Parse(spl[2]);
                List <Tuple <int, int> > cabList = new List <Tuple <int, int> >();
                for (int j = 0; j < cabbage; j++)
                {
                    input = Console.ReadLine();
                    spl   = input.Split(' ');
                    Tuple <int, int> temp = new Tuple <int, int>(int.Parse(spl[1]), int.Parse(spl[0]));   //get height, width point
                    cabList.Add(temp);
                }

                DFS dfs = new DFS(width, height, cabList);
                Console.WriteLine(dfs.startDFS());
            }
        }