結果

問題 No.1091 Range Xor Query
ユーザー tentententen
提出日時 2020-08-18 15:19:49
言語 Java21
(openjdk 21)
結果
AC  
実行時間 1,219 ms / 2,000 ms
コード長 581 bytes
コンパイル時間 1,860 ms
コンパイル使用メモリ 74,656 KB
実行使用メモリ 64,092 KB
最終ジャッジ日時 2024-04-20 07:36:51
合計ジャッジ時間 28,312 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
41,696 KB
testcase_01 AC 126 ms
41,792 KB
testcase_02 AC 105 ms
41,352 KB
testcase_03 AC 521 ms
49,600 KB
testcase_04 AC 796 ms
59,900 KB
testcase_05 AC 958 ms
61,100 KB
testcase_06 AC 368 ms
47,852 KB
testcase_07 AC 933 ms
60,584 KB
testcase_08 AC 994 ms
60,844 KB
testcase_09 AC 706 ms
55,232 KB
testcase_10 AC 990 ms
60,908 KB
testcase_11 AC 986 ms
61,832 KB
testcase_12 AC 905 ms
60,844 KB
testcase_13 AC 1,066 ms
63,188 KB
testcase_14 AC 984 ms
60,692 KB
testcase_15 AC 1,006 ms
62,012 KB
testcase_16 AC 943 ms
60,600 KB
testcase_17 AC 1,062 ms
60,856 KB
testcase_18 AC 553 ms
48,660 KB
testcase_19 AC 616 ms
50,896 KB
testcase_20 AC 1,001 ms
61,204 KB
testcase_21 AC 743 ms
53,780 KB
testcase_22 AC 1,032 ms
60,808 KB
testcase_23 AC 1,160 ms
61,512 KB
testcase_24 AC 1,084 ms
64,092 KB
testcase_25 AC 1,219 ms
63,812 KB
testcase_26 AC 1,067 ms
63,920 KB
testcase_27 AC 1,102 ms
64,036 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

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