結果
| 問題 |
No.1863 Xor Sum 2...?
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-03-04 22:25:00 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 855 bytes |
| コンパイル時間 | 1,531 ms |
| コンパイル使用メモリ | 168,208 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-18 20:56:49 |
| 合計ジャッジ時間 | 2,938 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 5 WA * 23 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#ifdef _RUTHEN
#include "debug.hpp"
#else
#define show(...) true
#endif
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
template <class T> using V = vector<T>;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
ll N;
cin >> N;
V<int> A(N), B(N);
rep(i, N) cin >> A[i];
rep(i, N) cin >> B[i];
int r = 0, c = 0;
ll s = 0, xs = 0, ans = 0;
for (int l = 0; l < N; l++) {
// hoge
while (r < N && (s + A[r]) == (xs ^ A[r])) {
s += A[r];
xs ^= A[r];
c += B[r];
r++;
}
show(l, r, s, xs, c, ans);
if (B[l] == 0) {
ans += r - l - c % 2;
}
s -= A[l];
xs ^= A[l];
c -= B[l];
}
cout << ans << '\n';
return 0;
}