Submission #6370737
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(); canUse = new bool[nm[1]]; 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 bool[] canUse; static int[] count; [MethodImpl(MethodImplOptions.AggressiveInlining)] static bool Judge(int[][] a, int target) { int canUseCount = canUse.Length; int[] indexer = new int[a.Length]; for (int i = 0; i < count.Length; i++) count[i] = 0; for (int i = 0; i < a.Length; i++) count[a[i][0]]++; for (int i = 0; i < canUse.Length; i++) canUse[i] = true; while (canUseCount > 0) { bool isValid = true; for (int i = 0; i < a.Length; i++) { if (canUse[a[i][indexer[i]]]) continue; while (!canUse[a[i][indexer[i]]]) indexer[i]++; count[a[i][indexer[i]]]++; } for (int i = 0; i < canUse.Length; i++) { if (!canUse[i]) continue; if (count[i] <= target) continue; canUse[i] = false; isValid = false; canUseCount--; } if (isValid) return true; } return false; } }
Submission Info
Submission Time | |
---|---|
Task | B - Sports Festival |
User | keymoon |
Language | C# (Mono 4.6.2.0) |
Score | 700 |
Code Size | 2292 Byte |
Status | AC |
Exec Time | 69 ms |
Memory | 17744 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 700 / 700 | ||||
Status |
|
|
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 | 28 ms | 11476 KB |
sample_02.txt | AC | 28 ms | 11476 KB |
sample_03.txt | AC | 29 ms | 13524 KB |
subtask_1_01.txt | AC | 29 ms | 13524 KB |
subtask_1_02.txt | AC | 28 ms | 11476 KB |
subtask_1_03.txt | AC | 29 ms | 9428 KB |
subtask_1_04.txt | AC | 30 ms | 11476 KB |
subtask_1_05.txt | AC | 28 ms | 11476 KB |
subtask_1_06.txt | AC | 34 ms | 11476 KB |
subtask_1_07.txt | AC | 38 ms | 13524 KB |
subtask_1_08.txt | AC | 31 ms | 11476 KB |
subtask_1_09.txt | AC | 28 ms | 13524 KB |
subtask_1_10.txt | AC | 29 ms | 9428 KB |
subtask_1_11.txt | AC | 34 ms | 11476 KB |
subtask_1_12.txt | AC | 29 ms | 11476 KB |
subtask_1_13.txt | AC | 36 ms | 11476 KB |
subtask_1_14.txt | AC | 56 ms | 15696 KB |
subtask_1_15.txt | AC | 67 ms | 15696 KB |
subtask_1_16.txt | AC | 57 ms | 17744 KB |
subtask_1_17.txt | AC | 57 ms | 15696 KB |
subtask_1_18.txt | AC | 69 ms | 13648 KB |