結果
| 問題 | No.3297 Bake Cookies | 
| コンテスト | |
| ユーザー |  aketijyuuzou | 
| 提出日時 | 2025-10-05 14:32:44 | 
| 言語 | C# (.NET 8.0.404) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 265 ms / 2,000 ms | 
| コード長 | 2,344 bytes | 
| コンパイル時間 | 9,952 ms | 
| コンパイル使用メモリ | 171,628 KB | 
| 実行使用メモリ | 219,528 KB | 
| 最終ジャッジ日時 | 2025-10-05 14:33:02 | 
| 合計ジャッジ時間 | 15,751 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 27 | 
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (140 ミリ秒)。 main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
    static string InputPattern = "InputX";
    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();
        if (InputPattern == "Input1") {
            WillReturn.Add("2 6 2");
            WillReturn.Add("1 1 1 1 1 2");
            //4
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("1 10 100");
            WillReturn.Add("1 1 1 1 1 1 1 1 1 1");
            //10
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }
    static long[] GetSplitArr(string pStr)
    {
        return (pStr == "" ? new string[0] : pStr.Split(' ')).Select(pX => long.Parse(pX)).ToArray();
    }
    static long mOvenCnt;
    static long mNeedTime;
    static long[] mAArr;
    static Dictionary<long, long> mCntDict = new Dictionary<long, long>();
    static void Main()
    {
        List<string> InputList = GetInputList();
        long[] wkArr = GetSplitArr(InputList[0]);
        mOvenCnt = wkArr[0];
        mNeedTime = wkArr[2];
        mAArr = GetSplitArr(InputList[1]);
        foreach (long EachA in mAArr) {
            if (mCntDict.ContainsKey(EachA) == false) {
                mCntDict[EachA] = 0;
            }
            mCntDict[EachA]++;
        }
        long L = 0;
        long R = long.MaxValue;
        while (L + 1 < R) {
            long Mid = R / 2;
            if (R < long.MaxValue) {
                Mid = (L + R) / 2;
            }
            if (CanAchieve(Mid)) {
                R = Mid;
            }
            else {
                L = Mid;
            }
        }
        Console.WriteLine(R);
    }
    // X分で可能かを返す
    static bool CanAchieve(long pX)
    {
        long HouwaCnt = 0;
        long YohuuCnt = 0;
        foreach (var EachPair in mCntDict) {
            if (EachPair.Value > pX) {
                HouwaCnt += EachPair.Value - pX;
            }
            if (EachPair.Value < pX) {
                long Buffer = pX - EachPair.Value;
                YohuuCnt += Buffer / mNeedTime;
            }            
        }
        if (HouwaCnt == 0) return true;
        return HouwaCnt <= YohuuCnt;
    }
}
            
            
            
        