結果

問題 No.2656 XOR Slimes
ユーザー 👑 kakel-sankakel-san
提出日時 2024-03-01 22:05:36
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 154 ms / 2,000 ms
コード長 912 bytes
コンパイル時間 6,530 ms
コンパイル使用メモリ 157,668 KB
実行使用メモリ 180,972 KB
最終ジャッジ日時 2024-03-01 22:07:01
合計ジャッジ時間 15,408 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
32,932 KB
testcase_01 AC 76 ms
32,932 KB
testcase_02 AC 73 ms
32,932 KB
testcase_03 AC 73 ms
32,804 KB
testcase_04 AC 73 ms
32,804 KB
testcase_05 AC 72 ms
32,804 KB
testcase_06 AC 96 ms
32,932 KB
testcase_07 AC 74 ms
32,804 KB
testcase_08 AC 125 ms
33,956 KB
testcase_09 AC 126 ms
33,956 KB
testcase_10 AC 130 ms
33,956 KB
testcase_11 AC 127 ms
33,956 KB
testcase_12 AC 127 ms
33,956 KB
testcase_13 AC 128 ms
33,956 KB
testcase_14 AC 127 ms
33,956 KB
testcase_15 AC 127 ms
33,956 KB
testcase_16 AC 127 ms
33,956 KB
testcase_17 AC 126 ms
33,956 KB
testcase_18 AC 139 ms
33,956 KB
testcase_19 AC 127 ms
33,956 KB
testcase_20 AC 127 ms
33,956 KB
testcase_21 AC 126 ms
33,956 KB
testcase_22 AC 127 ms
33,956 KB
testcase_23 AC 126 ms
33,956 KB
testcase_24 AC 126 ms
33,956 KB
testcase_25 AC 127 ms
33,956 KB
testcase_26 AC 126 ms
33,956 KB
testcase_27 AC 151 ms
34,084 KB
testcase_28 AC 127 ms
33,956 KB
testcase_29 AC 128 ms
34,084 KB
testcase_30 AC 127 ms
34,084 KB
testcase_31 AC 127 ms
34,084 KB
testcase_32 AC 126 ms
34,084 KB
testcase_33 AC 126 ms
34,084 KB
testcase_34 AC 128 ms
34,084 KB
testcase_35 AC 154 ms
34,084 KB
testcase_36 AC 127 ms
34,084 KB
testcase_37 AC 126 ms
34,084 KB
testcase_38 AC 128 ms
34,084 KB
testcase_39 AC 127 ms
34,084 KB
testcase_40 AC 133 ms
34,084 KB
testcase_41 AC 127 ms
34,084 KB
testcase_42 AC 127 ms
34,084 KB
testcase_43 AC 151 ms
34,212 KB
testcase_44 AC 128 ms
34,212 KB
testcase_45 AC 128 ms
34,212 KB
testcase_46 AC 127 ms
34,212 KB
testcase_47 AC 127 ms
34,212 KB
testcase_48 AC 127 ms
34,212 KB
testcase_49 AC 127 ms
34,212 KB
testcase_50 AC 129 ms
34,212 KB
testcase_51 AC 132 ms
34,212 KB
testcase_52 AC 133 ms
34,212 KB
testcase_53 AC 127 ms
34,212 KB
testcase_54 AC 126 ms
34,212 KB
testcase_55 AC 126 ms
34,212 KB
testcase_56 AC 128 ms
34,212 KB
testcase_57 AC 127 ms
34,212 KB
testcase_58 AC 127 ms
180,972 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (90 ms)。
MSBuild のバージョン 17.7.3+8ec440e68 (.NET)
  main -> /home/judge/data/code/bin/Release/net7.0/main.dll
  main -> /home/judge/data/code/bin/Release/net7.0/publish/

ソースコード

diff #

using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static int NN => int.Parse(ReadLine());
    static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
    static int[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var n = NN;
        var x = NList;
        var a = NList;
        var dp = Enumerable.Repeat(long.MaxValue / 2, n + 1).ToArray();
        dp[0] = 0;
        for (var i = 0; i < dp.Length; ++i)
        {
            var xor = 0;
            for (var j = i + 1; j < dp.Length; ++j)
            {
                xor ^= a[j - 1];
                dp[j] = Math.Min(dp[j], dp[i] + x[j - 1] - x[i] + xor);
            }
        }
        WriteLine(dp[n]);
    }
}
0