Esempio n. 1
0
File: 1.cs Progetto: qifanyyy/CLCDSA
        private static void Main(string[] args)
        {
            int tst = Console.ReadLine().ToInt();

            for (int cas = 1; cas < tst + 1; cas++)
            {
                int[] ar = Console.ReadLine().ToIntArray();
                int   N  = ar[0];
                int   M  = ar[1];
                int[,] input = new int[N, M];
                for (int i = 0; i < N; i++)
                {
                    int[] a = Console.ReadLine().ToIntArray();
                    for (int j = 0; j < M; j++)
                    {
                        input[i, j] = a[j];
                    }
                }
                bool[,] edge = new bool[N, N];
                for (int i = 0; i < N; i++)
                {
                    for (int j = 0; j < N; j++)
                    {
                        if (i == j)
                        {
                            continue;
                        }
                        bool flag = true;
                        for (int k = 0; k < M; k++)
                        {
                            if (input[i, k] >= input[j, k])
                            {
                                flag = false;
                                break;
                            }
                        }
                        if (flag)
                        {
                            edge[i, j] = true;
                        }
                    }
                }
                Console.WriteLine("Case #" + cas + ": " + (N - BipartiteMatching.Calc(edge)));
            }
        }