結果

問題 No.2656 XOR Slimes
ユーザー minimumminimum
提出日時 2024-03-01 21:45:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,123 ms / 2,000 ms
コード長 500 bytes
コンパイル時間 253 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 272,136 KB
最終ジャッジ日時 2024-03-01 21:46:07
合計ジャッジ時間 49,381 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
53,460 KB
testcase_01 AC 35 ms
53,460 KB
testcase_02 AC 35 ms
53,460 KB
testcase_03 AC 34 ms
53,460 KB
testcase_04 AC 33 ms
53,460 KB
testcase_05 AC 33 ms
53,460 KB
testcase_06 AC 33 ms
53,460 KB
testcase_07 AC 33 ms
53,460 KB
testcase_08 AC 897 ms
271,880 KB
testcase_09 AC 861 ms
271,880 KB
testcase_10 AC 882 ms
271,880 KB
testcase_11 AC 898 ms
271,880 KB
testcase_12 AC 901 ms
271,880 KB
testcase_13 AC 867 ms
271,880 KB
testcase_14 AC 882 ms
271,880 KB
testcase_15 AC 893 ms
271,880 KB
testcase_16 AC 869 ms
271,880 KB
testcase_17 AC 1,116 ms
272,008 KB
testcase_18 AC 1,123 ms
271,880 KB
testcase_19 AC 881 ms
271,880 KB
testcase_20 AC 890 ms
271,880 KB
testcase_21 AC 872 ms
271,880 KB
testcase_22 AC 899 ms
271,880 KB
testcase_23 AC 888 ms
272,008 KB
testcase_24 AC 870 ms
272,008 KB
testcase_25 AC 875 ms
272,008 KB
testcase_26 AC 1,116 ms
271,880 KB
testcase_27 AC 885 ms
271,880 KB
testcase_28 AC 1,106 ms
272,008 KB
testcase_29 AC 885 ms
272,008 KB
testcase_30 AC 889 ms
272,136 KB
testcase_31 AC 871 ms
272,136 KB
testcase_32 AC 888 ms
272,136 KB
testcase_33 AC 868 ms
272,136 KB
testcase_34 AC 886 ms
272,136 KB
testcase_35 AC 860 ms
272,008 KB
testcase_36 AC 877 ms
272,136 KB
testcase_37 AC 899 ms
272,136 KB
testcase_38 AC 896 ms
272,136 KB
testcase_39 AC 893 ms
272,136 KB
testcase_40 AC 1,093 ms
272,136 KB
testcase_41 AC 893 ms
272,136 KB
testcase_42 AC 880 ms
272,136 KB
testcase_43 AC 881 ms
272,136 KB
testcase_44 AC 1,112 ms
272,008 KB
testcase_45 AC 891 ms
272,008 KB
testcase_46 AC 876 ms
272,008 KB
testcase_47 AC 1,088 ms
272,136 KB
testcase_48 AC 897 ms
272,008 KB
testcase_49 AC 863 ms
272,008 KB
testcase_50 AC 1,111 ms
272,136 KB
testcase_51 AC 884 ms
272,136 KB
testcase_52 AC 1,121 ms
272,136 KB
testcase_53 AC 891 ms
272,136 KB
testcase_54 AC 888 ms
272,136 KB
testcase_55 AC 877 ms
272,136 KB
testcase_56 AC 900 ms
272,136 KB
testcase_57 AC 872 ms
272,136 KB
testcase_58 AC 871 ms
272,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
X = list(map(int, input().split()))
A = list(map(int, input().split()))

B = [0]
for i in range(N):
    B.append(B[-1] ^ A[i])

dp0 = [[0] * (N + 1) for _ in range(N + 1)]

for d in range(1, N + 1):
    for l in range(N):
        r = l + d
        if r > N:
            continue
        dp0[l][r] = (B[r] ^ B[l]) + X[r - 1] - X[l]

dp = [0] * (N + 1)
for r in range(1, N + 1):
    dp[r] = dp0[0][r]
    for l in range(r):
        dp[r] = min(dp[r], dp[l] + dp0[l][r])


print(dp[-1])
0