結果

問題 No.1091 Range Xor Query
ユーザー tenten
提出日時 2020-08-18 15:19:49
言語 Java
(openjdk 23)
結果
AC  
実行時間 1,386 ms / 2,000 ms
コード長 581 bytes
コンパイル時間 2,249 ms
コンパイル使用メモリ 74,228 KB
実行使用メモリ 63,668 KB
最終ジャッジ日時 2024-10-12 02:47:37
合計ジャッジ時間 34,604 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

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