結果

問題 No.1863 Xor Sum 2...?
ユーザー ieeiee
提出日時 2023-04-07 23:54:13
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 59 ms / 2,000 ms
コード長 400 bytes
コンパイル時間 3,917 ms
コンパイル使用メモリ 274,588 KB
実行使用メモリ 6,940 KB
最終ジャッジ日時 2024-04-10 18:20:17
合計ジャッジ時間 6,464 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,248 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 12 ms
5,248 KB
testcase_06 AC 6 ms
5,376 KB
testcase_07 AC 19 ms
5,376 KB
testcase_08 AC 19 ms
5,376 KB
testcase_09 AC 48 ms
5,376 KB
testcase_10 AC 45 ms
5,376 KB
testcase_11 AC 25 ms
5,376 KB
testcase_12 AC 19 ms
6,940 KB
testcase_13 AC 36 ms
5,376 KB
testcase_14 AC 45 ms
5,376 KB
testcase_15 AC 34 ms
5,376 KB
testcase_16 AC 36 ms
5,376 KB
testcase_17 AC 23 ms
5,376 KB
testcase_18 AC 9 ms
5,376 KB
testcase_19 AC 17 ms
5,376 KB
testcase_20 AC 29 ms
5,376 KB
testcase_21 AC 39 ms
5,376 KB
testcase_22 AC 15 ms
5,376 KB
testcase_23 AC 51 ms
5,376 KB
testcase_24 AC 55 ms
5,376 KB
testcase_25 AC 58 ms
5,376 KB
testcase_26 AC 57 ms
5,376 KB
testcase_27 AC 59 ms
5,376 KB
testcase_28 AC 57 ms
5,376 KB
testcase_29 AC 58 ms
5,376 KB
testcase_30 AC 58 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main() {
	int n;
	cin >> n;
	vector<int> a(n), b(n);
	for (auto &p: {&a, &b})
		for (int &x: *p)
			cin >> x;
	int res = 0;
	for (int i = 0; i < n; ++i) {
		int sm = 0, xo = 0, no = 0;
		for (int j = i; j < n; ++j) {
			sm += a[j], xo ^= a[j], no ^= b[j];
			if (sm != xo)
				break;
			if (sm - xo == no)
				++res;
		}
	}
	cout << res;
	return 0;
}
0