結果

問題 No.1456 Range Xor
ユーザー bluemeganebluemegane
提出日時 2021-05-20 17:26:03
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 76 ms / 2,000 ms
コード長 896 bytes
コンパイル時間 1,140 ms
コンパイル使用メモリ 110,848 KB
実行使用メモリ 33,280 KB
最終ジャッジ日時 2024-04-18 14:05:56
合計ジャッジ時間 4,941 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
18,304 KB
testcase_01 AC 26 ms
17,920 KB
testcase_02 AC 26 ms
17,792 KB
testcase_03 AC 72 ms
33,280 KB
testcase_04 AC 73 ms
33,280 KB
testcase_05 AC 73 ms
33,152 KB
testcase_06 AC 71 ms
33,024 KB
testcase_07 AC 76 ms
33,280 KB
testcase_08 AC 74 ms
33,280 KB
testcase_09 AC 70 ms
33,024 KB
testcase_10 AC 71 ms
32,768 KB
testcase_11 AC 38 ms
21,120 KB
testcase_12 AC 33 ms
19,456 KB
testcase_13 AC 45 ms
22,400 KB
testcase_14 AC 44 ms
22,016 KB
testcase_15 AC 66 ms
31,360 KB
testcase_16 AC 61 ms
28,416 KB
testcase_17 AC 49 ms
24,448 KB
testcase_18 AC 42 ms
22,144 KB
testcase_19 AC 54 ms
26,496 KB
testcase_20 AC 60 ms
28,672 KB
testcase_21 AC 57 ms
26,496 KB
testcase_22 AC 58 ms
26,752 KB
testcase_23 AC 45 ms
22,784 KB
testcase_24 AC 37 ms
19,956 KB
testcase_25 AC 42 ms
21,632 KB
testcase_26 AC 52 ms
25,088 KB
testcase_27 AC 60 ms
27,648 KB
testcase_28 AC 42 ms
21,376 KB
testcase_29 AC 72 ms
31,744 KB
testcase_30 AC 71 ms
32,640 KB
testcase_31 AC 40 ms
21,632 KB
testcase_32 AC 39 ms
21,376 KB
testcase_33 AC 48 ms
23,936 KB
testcase_34 AC 69 ms
32,768 KB
testcase_35 AC 51 ms
25,088 KB
testcase_36 AC 70 ms
32,896 KB
testcase_37 AC 71 ms
31,616 KB
testcase_38 AC 37 ms
20,104 KB
testcase_39 AC 59 ms
28,160 KB
testcase_40 AC 60 ms
28,160 KB
testcase_41 AC 30 ms
18,432 KB
testcase_42 AC 35 ms
19,908 KB
testcase_43 AC 26 ms
18,304 KB
testcase_44 AC 26 ms
17,920 KB
testcase_45 AC 25 ms
18,048 KB
testcase_46 AC 25 ms
18,048 KB
testcase_47 AC 26 ms
18,176 KB
testcase_48 AC 25 ms
18,048 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System.Collections.Generic;
using System;

public class Hello
{
    static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var k = int.Parse(line[1]);
        line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, int.Parse);
        var d = new Dictionary<int, int>();
        d[0] = 0;
        var b = new int[n];
        b[0] = a[0];
        d[b[0]] = 0;
        for (int i = 1; i < n; i++)
        {
            b[i] = b[i - 1] ^ a[i];
            d[b[i]] = i;
        }
        getAns(n, k, b, d);

    }
    static void getAns(int n, int k, int[] b, Dictionary<int, int> d)
    {
        for (int i = 0; i < n; i++)
        {
            var w = b[i] ^ k;
            if (d.ContainsKey(w)) { Console.WriteLine("Yes"); return; }
        }
        Console.WriteLine("No");
    }
}
0