結果

問題 No.1091 Range Xor Query
ユーザー forest3forest3
提出日時 2020-07-02 21:37:58
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 400 ms / 2,000 ms
コード長 374 bytes
コンパイル時間 1,478 ms
コンパイル使用メモリ 167,076 KB
実行使用メモリ 4,836 KB
最終ジャッジ日時 2023-10-13 08:47:19
合計ジャッジ時間 13,955 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,352 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 55 ms
4,348 KB
testcase_04 AC 234 ms
4,352 KB
testcase_05 AC 258 ms
4,648 KB
testcase_06 AC 11 ms
4,352 KB
testcase_07 AC 254 ms
4,352 KB
testcase_08 AC 362 ms
4,352 KB
testcase_09 AC 183 ms
4,348 KB
testcase_10 AC 254 ms
4,352 KB
testcase_11 AC 319 ms
4,348 KB
testcase_12 AC 189 ms
4,356 KB
testcase_13 AC 377 ms
4,348 KB
testcase_14 AC 272 ms
4,356 KB
testcase_15 AC 296 ms
4,396 KB
testcase_16 AC 298 ms
4,352 KB
testcase_17 AC 379 ms
4,548 KB
testcase_18 AC 61 ms
4,348 KB
testcase_19 AC 76 ms
4,348 KB
testcase_20 AC 382 ms
4,348 KB
testcase_21 AC 182 ms
4,352 KB
testcase_22 AC 351 ms
4,348 KB
testcase_23 AC 395 ms
4,688 KB
testcase_24 AC 391 ms
4,836 KB
testcase_25 AC 380 ms
4,568 KB
testcase_26 AC 400 ms
4,696 KB
testcase_27 AC 388 ms
4,668 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main()
{
	int N, Q;
	cin >> N >> Q;
	vector<int> a( N );
	for( int i = 0; i < N; i++ ) {
		cin >> a[i];
	}

	vector<int> acc( N + 1 );
	for( int i = 0; i < N; i++ ) {
		acc[i + 1] = acc[i] ^ a[i];
	}

	for( int i = 0; i < Q; i++ ) {
		int l, r;
		cin >> l >> r;
		int ans = acc[r] ^ acc[l - 1];
		cout << ans << endl;
	}
}
0