結果
| 問題 |
No.2656 XOR Slimes
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-03-01 21:50:49 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 252 ms / 2,000 ms |
| コード長 | 513 bytes |
| コンパイル時間 | 318 ms |
| コンパイル使用メモリ | 82,048 KB |
| 実行使用メモリ | 71,908 KB |
| 最終ジャッジ日時 | 2024-09-29 13:48:20 |
| 合計ジャッジ時間 | 11,173 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 55 |
ソースコード
import sys
from itertools import permutations
from heapq import heappop,heappush
from collections import deque
import random
import bisect
input = lambda :sys.stdin.readline().rstrip()
mi = lambda :map(int,input().split())
li = lambda :list(mi())
N = int(input())
X = li()
A = li()
INF = 3 * 10**9
dp = [INF] * (N+1)
dp[0] = 0
for l in range(N):
tmp_xor = A[l]
for r in range(l+1,N+1):
dp[r] = min(dp[r],dp[l]+X[r-1]-X[l]+tmp_xor)
if r!=N:
tmp_xor ^= A[r]
print(dp[-1])