結果
問題 |
No.1091 Range Xor Query
|
ユーザー |
![]() |
提出日時 | 2020-12-14 13:54:48 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 1,255 ms / 2,000 ms |
コード長 | 508 bytes |
コンパイル時間 | 2,310 ms |
コンパイル使用メモリ | 74,196 KB |
実行使用メモリ | 63,836 KB |
最終ジャッジ日時 | 2024-09-20 00:42:15 |
合計ジャッジ時間 | 30,021 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 27 |
ソースコード
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); } }