結果

問題 No.1091 Range Xor Query
ユーザー TententenTententen
提出日時 2020-12-14 13:54:48
言語 Java21
(openjdk 21)
結果
AC  
実行時間 1,209 ms / 2,000 ms
コード長 508 bytes
コンパイル時間 2,100 ms
コンパイル使用メモリ 74,568 KB
実行使用メモリ 76,904 KB
最終ジャッジ日時 2023-10-20 04:59:38
合計ジャッジ時間 29,763 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
57,592 KB
testcase_01 AC 127 ms
57,520 KB
testcase_02 AC 128 ms
57,504 KB
testcase_03 AC 591 ms
65,984 KB
testcase_04 AC 844 ms
74,216 KB
testcase_05 AC 1,010 ms
74,360 KB
testcase_06 AC 321 ms
60,588 KB
testcase_07 AC 931 ms
73,992 KB
testcase_08 AC 1,070 ms
74,504 KB
testcase_09 AC 776 ms
71,956 KB
testcase_10 AC 1,041 ms
74,252 KB
testcase_11 AC 1,045 ms
74,360 KB
testcase_12 AC 956 ms
74,588 KB
testcase_13 AC 1,043 ms
76,244 KB
testcase_14 AC 985 ms
74,144 KB
testcase_15 AC 1,077 ms
74,572 KB
testcase_16 AC 971 ms
74,108 KB
testcase_17 AC 1,156 ms
74,812 KB
testcase_18 AC 487 ms
61,148 KB
testcase_19 AC 650 ms
66,704 KB
testcase_20 AC 1,128 ms
74,820 KB
testcase_21 AC 728 ms
70,512 KB
testcase_22 AC 1,135 ms
72,152 KB
testcase_23 AC 1,209 ms
74,916 KB
testcase_24 AC 1,135 ms
76,476 KB
testcase_25 AC 1,180 ms
76,904 KB
testcase_26 AC 1,132 ms
76,604 KB
testcase_27 AC 1,095 ms
76,272 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int q = sc.nextInt();
		int[] arr = new int[n + 1];
		for (int i = 1; i <= n; i++) {
		    arr[i] = arr[i - 1] ^ sc.nextInt();
		}
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < q; i++) {
		    int left = sc.nextInt();
		    int right = sc.nextInt();
		    sb.append(arr[right] ^ arr[left - 1]).append("\n");
		}
		System.out.print(sb);
	}
}
0