Submission #6369990


Source Code Expand

using System;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using static System.Math;
using Debug = System.Diagnostics.Debug;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;


static class P
{
    static void Main()
    {
        var nm = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var a = Enumerable.Repeat(0, nm[0]).Select(_ => Console.ReadLine().Split().Select(x => int.Parse(x) - 1).ToArray()).ToArray();
        count = new int[nm[1]];
        var possible = nm[0];
        var impossible = 0;
        while (possible - impossible > 1)
        {
            var mid = (possible + impossible) / 2;
            if (Judge(a, mid)) possible = mid;
            else impossible = mid;
        }
        Console.WriteLine(possible);
    }

    static int[] count;
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    static bool Judge(int[][] a, int target)
    {
        while (a[0].Length > 0)
        {
            for (int i = 0; i < count.Length; i++)
                count[i] = 0;
            for (int i = 0; i < a.Length; i++)
                count[a[i][0]]++;
            if (count.All(x => x <= target)) return true;
            a = a.Select(x => x.Where(y => count[y] <= target).ToArray()).ToArray();
        }
        return false;
    }
}

Submission Info

Submission Time
Task B - Sports Festival
User keymoon
Language C# (Mono 4.6.2.0)
Score 0
Code Size 1562 Byte
Status TLE
Exec Time 2105 ms
Memory 34064 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 700
Status
AC × 3
AC × 23
TLE × 1
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All sample_01.txt, sample_02.txt, sample_03.txt, sample_01.txt, sample_02.txt, sample_03.txt, subtask_1_01.txt, subtask_1_02.txt, subtask_1_03.txt, subtask_1_04.txt, subtask_1_05.txt, subtask_1_06.txt, subtask_1_07.txt, subtask_1_08.txt, subtask_1_09.txt, subtask_1_10.txt, subtask_1_11.txt, subtask_1_12.txt, subtask_1_13.txt, subtask_1_14.txt, subtask_1_15.txt, subtask_1_16.txt, subtask_1_17.txt, subtask_1_18.txt
Case Name Status Exec Time Memory
sample_01.txt AC 29 ms 11604 KB
sample_02.txt AC 29 ms 11604 KB
sample_03.txt AC 29 ms 11604 KB
subtask_1_01.txt AC 26 ms 11476 KB
subtask_1_02.txt AC 29 ms 11604 KB
subtask_1_03.txt AC 38 ms 15696 KB
subtask_1_04.txt AC 33 ms 13652 KB
subtask_1_05.txt AC 29 ms 9556 KB
subtask_1_06.txt AC 42 ms 15824 KB
subtask_1_07.txt AC 236 ms 22424 KB
subtask_1_08.txt AC 44 ms 13772 KB
subtask_1_09.txt AC 30 ms 11604 KB
subtask_1_10.txt AC 32 ms 11604 KB
subtask_1_11.txt AC 194 ms 20548 KB
subtask_1_12.txt AC 30 ms 11604 KB
subtask_1_13.txt AC 75 ms 17328 KB
subtask_1_14.txt AC 74 ms 19776 KB
subtask_1_15.txt AC 1903 ms 34064 KB
subtask_1_16.txt AC 78 ms 17468 KB
subtask_1_17.txt AC 284 ms 33908 KB
subtask_1_18.txt TLE 2105 ms 33728 KB