結果

問題 No.1091 Range Xor Query
ユーザー tentententen
提出日時 2022-08-04 14:14:45
言語 Java21
(openjdk 21)
結果
AC  
実行時間 491 ms / 2,000 ms
コード長 1,255 bytes
コンパイル時間 2,019 ms
コンパイル使用メモリ 74,188 KB
実行使用メモリ 65,588 KB
最終ジャッジ日時 2023-10-12 11:45:02
合計ジャッジ時間 17,736 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
49,452 KB
testcase_01 AC 42 ms
49,340 KB
testcase_02 AC 43 ms
49,464 KB
testcase_03 AC 233 ms
55,988 KB
testcase_04 AC 355 ms
61,496 KB
testcase_05 AC 422 ms
64,248 KB
testcase_06 AC 132 ms
54,812 KB
testcase_07 AC 416 ms
61,032 KB
testcase_08 AC 457 ms
60,584 KB
testcase_09 AC 329 ms
58,220 KB
testcase_10 AC 426 ms
60,984 KB
testcase_11 AC 466 ms
61,480 KB
testcase_12 AC 388 ms
60,276 KB
testcase_13 AC 468 ms
61,372 KB
testcase_14 AC 439 ms
60,884 KB
testcase_15 AC 451 ms
63,504 KB
testcase_16 AC 388 ms
60,848 KB
testcase_17 AC 486 ms
63,192 KB
testcase_18 AC 211 ms
57,468 KB
testcase_19 AC 255 ms
56,252 KB
testcase_20 AC 450 ms
61,192 KB
testcase_21 AC 291 ms
59,336 KB
testcase_22 AC 476 ms
63,408 KB
testcase_23 AC 479 ms
62,884 KB
testcase_24 AC 489 ms
65,352 KB
testcase_25 AC 482 ms
65,588 KB
testcase_26 AC 491 ms
64,772 KB
testcase_27 AC 488 ms
65,180 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;

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

class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    
    public Scanner() throws Exception {
        
    }
    
    public int nextInt() throws Exception {
        return Integer.parseInt(next());
    }
    
    public long nextLong() throws Exception {
        return Long.parseLong(next());
    }
    
    public double nextDouble() throws Exception {
        return Double.parseDouble(next());
    }
    
    public String next() throws Exception {
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
}
0