AtCoder Grand Contest 018

Submission #6369923

Source codeソースコード

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

Task問題 B - Sports Festival
User nameユーザ名 keymoon
Created time投稿日時
Language言語 C# (Mono 4.6.2.0)
Status状態 TLE
Score得点 0
Source lengthソースコード長 1633 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Test case

Set

Set name Score得点 / Max score Cases
Sample - sample_01.txt,sample_02.txt,sample_03.txt
All 0 / 700 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

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
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