結果
| 問題 | No.3302 Sense Battle | 
| コンテスト | |
| ユーザー |  aketijyuuzou | 
| 提出日時 | 2025-10-05 15:30:58 | 
| 言語 | C# (.NET 8.0.404) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 2,775 bytes | 
| コンパイル時間 | 9,085 ms | 
| コンパイル使用メモリ | 172,384 KB | 
| 実行使用メモリ | 215,260 KB | 
| 最終ジャッジ日時 | 2025-10-05 15:31:19 | 
| 合計ジャッジ時間 | 19,229 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | WA * 18 | 
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (105 ミリ秒)。 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("4");
            WillReturn.Add("200 100");
            WillReturn.Add("300 500");
            WillReturn.Add("500 200");
            WillReturn.Add("700 100");
            //1500
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("1");
            WillReturn.Add("1000000000 1");
            //1
        }
        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 AddPower;
        internal long AttackPlus;
    }
    static List<ItemInfoDef> mItemInfoList = new List<ItemInfoDef>();
    static void Main()
    {
        List<string> InputList = GetInputList();
        long[] wkArr = { };
        Action<string> SplitAct = (pStr) => wkArr = GetSplitArr(pStr);
        foreach (string EachStr in InputList.Skip(1)) {
            SplitAct(EachStr);
            ItemInfoDef WillAdd;
            WillAdd.AddPower = wkArr[0];
            WillAdd.AttackPlus = wkArr[1];
            mItemInfoList.Add(WillAdd);
        }
        mItemInfoList.Reverse();
        long UB = mItemInfoList.Count - 1;
        // 最大スコア[攻撃回数]なDP表
        long?[] PrevDP = new long?[UB + 10];
        PrevDP[0] = 0;
        long Answer = long.MinValue;
        foreach (ItemInfoDef EachItemInfo in mItemInfoList) {
            long?[] CurrDP = new long?[UB + 10];
            for (long I = 0; I <= UB; I++) {
                if (PrevDP[I].HasValue == false) continue;
                Action<long, long> UpdateAct = (pNewInd, pNewVal) =>
                {
                    if (CurrDP[pNewInd].HasValue) {
                        if (CurrDP[pNewInd] >= pNewVal) {
                            return;
                        }
                    }
                    CurrDP[pNewInd] = pNewVal;
                    Answer = Math.Max(Answer, pNewVal);
                };
                // 攻撃する場合
                long AddVal = EachItemInfo.AttackPlus;
                UpdateAct(I + 1, PrevDP[I].Value + AddVal);
                // 力を増やす場合
                UpdateAct(I, PrevDP[I].Value + EachItemInfo.AttackPlus * I);
            }
            PrevDP = CurrDP;
        }
        Console.WriteLine(Answer);
    }
}
            
            
            
        