結果
| 問題 |
No.2656 XOR Slimes
|
| コンテスト | |
| ユーザー |
Today03
|
| 提出日時 | 2024-03-01 22:52:47 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 895 bytes |
| コンパイル時間 | 2,067 ms |
| コンパイル使用メモリ | 196,344 KB |
| 最終ジャッジ日時 | 2025-02-19 22:54:48 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 4 WA * 51 |
ソースコード
#include <bits/stdc++.h>
#ifdef LOCAL
#include "./debug.cpp"
#else
#define debug(...)
#define print_line
#endif
using namespace std;
using ll = long long;
int main() {
int N;
cin >> N;
vector<int> X(N), A(N);
for (int i = 0; i < N; i++) {
cin >> A[i];
}
for (int i = 0; i < N; i++) {
cin >> X[i];
}
vector<ll> Xsum1(N + 1, 0), Xsum2(N + 1, 0);
for (int i = 0; i < N; i++) {
Xsum1[i + 1] = Xsum1[i] ^ X[i];
Xsum2[i + 1] = Xsum2[i] + X[i];
}
ll ans = LLONG_MAX;
for (int i = 0; i < N; i++) {
for (int j = i; j < N; j++) {
ll x1 = Xsum2[i];
ll x2 = Xsum1[j + 1] ^ Xsum1[i];
ll x3 = Xsum2[N] - Xsum2[j + 1];
ll a1 = A[j] - A[i];
debug(i, j, x1, x2, x3, a1);
ans = min(ans, x1 + x2 + x3 + a1);
}
}
cout << ans << endl;
}
Today03