結果

問題 No.3324 ハイライト動画
コンテスト
ユーザー aketijyuuzou
提出日時 2025-11-23 18:32:23
言語 C#
(.NET 8.0.404)
結果
AC  
実行時間 635 ms / 2,000 ms
コード長 2,018 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 8,147 ms
コンパイル使用メモリ 167,956 KB
実行使用メモリ 189,092 KB
最終ジャッジ日時 2025-11-23 18:32:39
合計ジャッジ時間 15,510 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (116 ミリ秒)。
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #
raw source code

using System;
using System.Collections.Generic;
using System.Linq;

// https://yukicoder.me/problems/no/3324
class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("10 6");
            WillReturn.Add("1 2 4 5 6 10");
            //3
            //1 2
            //4 3
            //10 1
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("5 5");
            WillReturn.Add("1 2 3 4 5");
            //1
            //1 5
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("360000 14");
            WillReturn.Add("1 2 3 12 13 14 15 16 359995 359996 359997 359998 359999 360000");
            //3
            //1 3
            //12 5
            //359995 6
        }
        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();
    }

    struct ItemInfoDef
    {
        internal long Distance;
        internal long AVal;
    }
    static List<ItemInfoDef> mItemInfoList = new List<ItemInfoDef>();

    static void Main()
    {
        List<string> InputList = GetInputList();
        long[] AArr = GetSplitArr(InputList[1]);

        for (long I = 0; I <= AArr.GetUpperBound(0); I++) {
            ItemInfoDef WillAdd;
            WillAdd.Distance = AArr[I] - I;
            WillAdd.AVal = AArr[I];
            mItemInfoList.Add(WillAdd);
        }

        var Query = mItemInfoList.GroupBy(pX => pX.Distance).ToArray();
        Console.WriteLine(Query.Count());
        foreach (var EachPair in Query.OrderBy(pX => pX.Key)) {
            Console.WriteLine("{0} {1}", EachPair.Min(pX => pX.AVal), EachPair.Count());
        }
    }
}
0