Submission #1647934


Source Code Expand

using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
class Simple {
    int N, K;
    string[] P;
    void Solve() {
        //input
        N = io.Int;
        K = io.Int;
        P = new string[N];
        for (int i = 0; i < N; ++i)
            P[i] = io.String;
        //cal
        var ans = 0;
        var map = new int['z' - 'a' + 1];
        for (int i = 0; i < P.Length; ++i)
            map[P[i][0] - 'A']++;
        for (;;) {
            var cnt = 0;
            for (int i = 0; i < map.Length; ++i) {
                if (map[i] > 0) { cnt++; map[i]--; }
                if (cnt == K) { ans++; break; }
            }
            if (cnt != K) break;
        }
        //ret
        Console.WriteLine(ans);
    }

    SimpleIO io = new SimpleIO();
    public static void Main(string[] args) { new Simple().Stream(); }
    void Stream() {
        Solve();
        io.writeFlush();
    }
}

class SimpleIO {
    string[] nextBuffer;
    int BufferCnt;
    char[] cs = new char[] { ' ' };
    StreamWriter sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
    public SimpleIO() {
        nextBuffer = new string[0];
        BufferCnt = 0;
        Console.SetOut(sw);
    }
    public string Next() {
        if (BufferCnt < nextBuffer.Length)
            return nextBuffer[BufferCnt++];
        string st = Console.ReadLine();
        while (st == "")
            st = Console.ReadLine();
        nextBuffer = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        BufferCnt = 0;
        return nextBuffer[BufferCnt++];
    }
    public string String => Next();
    public char Char => char.Parse(String);
    public int Int => int.Parse(String);
    public long Long => long.Parse(String);
    public double Double => double.Parse(String);
    public void writeFlush() { Console.Out.Flush(); }
}

Submission Info

Submission Time
Task A - A Barricade
User rui0422
Language C# (Mono 4.6.2.0)
Score 0
Code Size 2038 Byte
Status RE
Exec Time 21 ms
Memory 12768 KB

Judge Result

Set Name All
Score / Max Score 0 / 66
Status
RE × 9
Set Name Test Cases
All 00_sample.txt, 01_sample.txt, 02_sampe.txt, 03_sample.txt, corner_case_03.txt, corner_case_04.txt, random_case_00.txt, random_case_01.txt, random_case_02.txt
Case Name Status Exec Time Memory
00_sample.txt RE 21 ms 12768 KB
01_sample.txt RE 21 ms 12768 KB
02_sampe.txt RE 20 ms 10720 KB
03_sample.txt RE 20 ms 10720 KB
corner_case_03.txt RE 20 ms 8672 KB
corner_case_04.txt RE 20 ms 8672 KB
random_case_00.txt RE 20 ms 10720 KB
random_case_01.txt RE 20 ms 8672 KB
random_case_02.txt RE 21 ms 12768 KB