結果

問題 No.2656 XOR Slimes
ユーザー flygonflygon
提出日時 2024-03-01 22:11:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 829 ms / 2,000 ms
コード長 629 bytes
コンパイル時間 189 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 272,540 KB
最終ジャッジ日時 2024-03-01 22:11:53
合計ジャッジ時間 35,873 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
55,728 KB
testcase_01 AC 42 ms
55,728 KB
testcase_02 AC 43 ms
55,728 KB
testcase_03 AC 43 ms
55,728 KB
testcase_04 AC 43 ms
55,728 KB
testcase_05 AC 43 ms
55,728 KB
testcase_06 AC 42 ms
55,728 KB
testcase_07 AC 43 ms
55,728 KB
testcase_08 AC 633 ms
272,412 KB
testcase_09 AC 617 ms
272,540 KB
testcase_10 AC 631 ms
272,412 KB
testcase_11 AC 658 ms
272,412 KB
testcase_12 AC 641 ms
272,412 KB
testcase_13 AC 617 ms
272,540 KB
testcase_14 AC 638 ms
272,412 KB
testcase_15 AC 612 ms
272,540 KB
testcase_16 AC 592 ms
272,540 KB
testcase_17 AC 776 ms
272,540 KB
testcase_18 AC 803 ms
272,412 KB
testcase_19 AC 594 ms
272,540 KB
testcase_20 AC 621 ms
272,540 KB
testcase_21 AC 606 ms
272,540 KB
testcase_22 AC 667 ms
272,412 KB
testcase_23 AC 597 ms
272,540 KB
testcase_24 AC 648 ms
272,540 KB
testcase_25 AC 594 ms
272,540 KB
testcase_26 AC 818 ms
272,412 KB
testcase_27 AC 637 ms
272,412 KB
testcase_28 AC 814 ms
272,540 KB
testcase_29 AC 664 ms
272,412 KB
testcase_30 AC 593 ms
272,540 KB
testcase_31 AC 596 ms
272,540 KB
testcase_32 AC 627 ms
272,540 KB
testcase_33 AC 667 ms
272,412 KB
testcase_34 AC 597 ms
272,540 KB
testcase_35 AC 692 ms
272,412 KB
testcase_36 AC 630 ms
272,412 KB
testcase_37 AC 662 ms
272,412 KB
testcase_38 AC 604 ms
272,540 KB
testcase_39 AC 624 ms
272,540 KB
testcase_40 AC 779 ms
272,412 KB
testcase_41 AC 661 ms
272,412 KB
testcase_42 AC 644 ms
272,412 KB
testcase_43 AC 653 ms
272,540 KB
testcase_44 AC 783 ms
272,412 KB
testcase_45 AC 664 ms
272,412 KB
testcase_46 AC 635 ms
272,412 KB
testcase_47 AC 829 ms
272,540 KB
testcase_48 AC 667 ms
272,412 KB
testcase_49 AC 635 ms
272,412 KB
testcase_50 AC 827 ms
272,412 KB
testcase_51 AC 603 ms
272,540 KB
testcase_52 AC 812 ms
272,412 KB
testcase_53 AC 632 ms
272,412 KB
testcase_54 AC 671 ms
272,412 KB
testcase_55 AC 641 ms
272,412 KB
testcase_56 AC 620 ms
272,540 KB
testcase_57 AC 635 ms
272,540 KB
testcase_58 AC 599 ms
272,540 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(5*10**5)
input = sys.stdin.readline
from collections import defaultdict, deque, Counter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
from math import gcd

n = int(input())
x = list(map(int,input().split()))
a = list(map(int,input().split()))

sum = [[0]*n for i in range(n)]
for l in range(n):
    now = 0
    for r in range(l, n):
        now ^= a[r]
        sum[l][r] = now + x[r] - x[l]
dp = [10**15]*(n+1)
dp[0] = 0
for i in range(1, n+1):
    for j in range(1,i+1):
        tmp = sum[j-1][i-1]        
        dp[i] = min(dp[i],tmp+dp[j-1])

print(dp[-1])
0