結果
| 問題 |
No.2656 XOR Slimes
|
| コンテスト | |
| ユーザー |
sotanishy
|
| 提出日時 | 2024-03-01 21:29:43 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 217 ms / 2,000 ms |
| コード長 | 389 bytes |
| コンパイル時間 | 221 ms |
| コンパイル使用メモリ | 82,316 KB |
| 実行使用メモリ | 66,136 KB |
| 最終ジャッジ日時 | 2024-09-29 13:31:48 |
| 合計ジャッジ時間 | 9,114 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 55 |
ソースコード
import sys
input = sys.stdin.readline
N = int(input())
X = list(map(int, input().split()))
A = list(map(int, input().split()))
cumxor = [0] * (N + 1)
for i, x in enumerate(A):
cumxor[i + 1] = cumxor[i] ^ x
dp = [10**18] * (N + 1)
dp[0] = 0
for i in range(N):
for j in range(i+1):
dp[i + 1] = min(dp[i + 1], dp[j] + (cumxor[i + 1] ^ cumxor[j]) + X[i] - X[j])
print(dp[N])
sotanishy