Submission #6369923


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(int.Parse).ToArray()).ToArray();
        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);
    }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    static bool Judge(int[][] a, int target)
    {
        bool[] cantUse = new bool[a[0].Length + 1];
        while (a[0].Length > 0)
        {
            var invalidList = a.Select(x => x[0]).GroupBy(x => x).Where(x => target < x.Count()).Select(x => x.Key).ToArray();
            if (invalidList.Length == 0) return true;
            for (int i = 0; i < invalidList.Length; i++)
            {
                cantUse[invalidList[i]] = true;
            }
            a = a.Select(x => x.Where(y => !cantUse[y]).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 1633 Byte
Status TLE
Exec Time 2105 ms
Memory 38060 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 34 ms 13780 KB
sample_02.txt AC 33 ms 11604 KB
sample_03.txt AC 34 ms 13780 KB
subtask_1_01.txt AC 27 ms 13396 KB
subtask_1_02.txt AC 33 ms 11732 KB
subtask_1_03.txt AC 42 ms 15712 KB
subtask_1_04.txt AC 38 ms 13664 KB
subtask_1_05.txt AC 34 ms 11616 KB
subtask_1_06.txt AC 47 ms 15960 KB
subtask_1_07.txt AC 247 ms 22560 KB
subtask_1_08.txt AC 49 ms 13896 KB
subtask_1_09.txt AC 34 ms 11616 KB
subtask_1_10.txt AC 36 ms 11616 KB
subtask_1_11.txt AC 199 ms 18392 KB
subtask_1_12.txt AC 35 ms 11732 KB
subtask_1_13.txt AC 79 ms 17468 KB
subtask_1_14.txt AC 77 ms 17360 KB
subtask_1_15.txt AC 1925 ms 31856 KB
subtask_1_16.txt AC 82 ms 17356 KB
subtask_1_17.txt AC 297 ms 32616 KB
subtask_1_18.txt TLE 2105 ms 38060 KB