結果

問題 No.2656 XOR Slimes
ユーザー てんぷら
提出日時 2024-02-28 22:23:44
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 783 bytes
コンパイル時間 4,906 ms
コンパイル使用メモリ 306,556 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-09-29 12:26:13
合計ジャッジ時間 6,853 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 46 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <atcoder/all>
#include <bits/stdc++.h>
using ll = long long;
using ull = unsigned long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
using namespace std;
using namespace atcoder;
using mint = modint998244353;
const int inf = 1000000007;
const ll longinf = 1ll << 60;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vector<int> a(n), x(n);
    rep(i, n) cin >> x[i];
    rep(i, n) cin >> a[i];
    vector dp(n + 1, inf);
    dp[0] = 0;
    rep(i, n) {
        int v = 0;
        REP(j, i, n) {
            v ^= a[j];
            dp[j + 1] = min(dp[j + 1], dp[i] + v + x[j] - x[i]);
        }
    }
    cout << dp[n] << endl;
    return 0;
}
0