結果

問題 No.1091 Range Xor Query
ユーザー bluemeganebluemegane
提出日時 2020-06-24 17:13:03
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 327 ms / 2,000 ms
コード長 907 bytes
コンパイル時間 818 ms
コンパイル使用メモリ 65,856 KB
実行使用メモリ 42,916 KB
最終ジャッジ日時 2023-09-16 21:08:36
合計ジャッジ時間 9,737 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
20,812 KB
testcase_01 AC 59 ms
18,748 KB
testcase_02 AC 59 ms
20,732 KB
testcase_03 AC 120 ms
36,560 KB
testcase_04 AC 201 ms
32,084 KB
testcase_05 AC 245 ms
40,240 KB
testcase_06 AC 76 ms
21,924 KB
testcase_07 AC 226 ms
37,648 KB
testcase_08 AC 293 ms
40,932 KB
testcase_09 AC 172 ms
32,136 KB
testcase_10 AC 236 ms
41,300 KB
testcase_11 AC 283 ms
41,676 KB
testcase_12 AC 210 ms
42,108 KB
testcase_13 AC 304 ms
38,292 KB
testcase_14 AC 247 ms
37,588 KB
testcase_15 AC 266 ms
42,144 KB
testcase_16 AC 234 ms
33,668 KB
testcase_17 AC 318 ms
42,012 KB
testcase_18 AC 103 ms
27,016 KB
testcase_19 AC 130 ms
36,212 KB
testcase_20 AC 296 ms
39,548 KB
testcase_21 AC 172 ms
30,540 KB
testcase_22 AC 293 ms
40,772 KB
testcase_23 AC 321 ms
42,916 KB
testcase_24 AC 321 ms
40,680 KB
testcase_25 AC 322 ms
40,676 KB
testcase_26 AC 320 ms
38,660 KB
testcase_27 AC 327 ms
42,768 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System.Text;
using System;

public class Hello
{
    static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var q = int.Parse(line[1]);
        line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, int.Parse);
        getAns(n, q, a);
    }
    static void getAns(int n, int q, int[] a)
    {
        var sb = new StringBuilder();
        var b = new int[n];
        b[0] = 0 ^ a[0];
        for (int i = 1; i < n; i++)
            b[i] = b[i - 1] ^ a[i];
        for (int i = 0; i < q; i++)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            var L = int.Parse(line[0]) - 1;
            var r = int.Parse(line[1]) - 1;
            sb.Append(L == 0 ? b[r].ToString() + "\n" : (b[r] ^ b[L - 1]).ToString() + "\n");
        }
        Console.Write(sb);
    }
}
0