結果

問題 No.1456 Range Xor
ユーザー bluemeganebluemegane
提出日時 2021-05-20 17:29:30
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 80 ms / 2,000 ms
コード長 883 bytes
コンパイル時間 811 ms
コンパイル使用メモリ 104,576 KB
実行使用メモリ 34,176 KB
最終ジャッジ日時 2024-04-18 14:06:02
合計ジャッジ時間 4,957 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
19,968 KB
testcase_01 AC 28 ms
19,584 KB
testcase_02 AC 27 ms
19,840 KB
testcase_03 AC 78 ms
33,920 KB
testcase_04 AC 77 ms
34,048 KB
testcase_05 AC 80 ms
33,792 KB
testcase_06 AC 79 ms
33,920 KB
testcase_07 AC 80 ms
33,920 KB
testcase_08 AC 79 ms
33,920 KB
testcase_09 AC 79 ms
33,664 KB
testcase_10 AC 78 ms
34,048 KB
testcase_11 AC 41 ms
22,656 KB
testcase_12 AC 35 ms
20,864 KB
testcase_13 AC 47 ms
23,680 KB
testcase_14 AC 46 ms
23,808 KB
testcase_15 AC 71 ms
32,000 KB
testcase_16 AC 66 ms
29,568 KB
testcase_17 AC 53 ms
25,728 KB
testcase_18 AC 45 ms
23,552 KB
testcase_19 AC 59 ms
28,160 KB
testcase_20 AC 65 ms
29,568 KB
testcase_21 AC 57 ms
27,648 KB
testcase_22 AC 59 ms
28,160 KB
testcase_23 AC 48 ms
24,192 KB
testcase_24 AC 39 ms
21,580 KB
testcase_25 AC 46 ms
23,552 KB
testcase_26 AC 56 ms
26,624 KB
testcase_27 AC 64 ms
29,312 KB
testcase_28 AC 45 ms
23,236 KB
testcase_29 AC 78 ms
32,512 KB
testcase_30 AC 76 ms
33,152 KB
testcase_31 AC 42 ms
22,852 KB
testcase_32 AC 42 ms
22,400 KB
testcase_33 AC 52 ms
25,600 KB
testcase_34 AC 75 ms
33,024 KB
testcase_35 AC 55 ms
26,624 KB
testcase_36 AC 77 ms
34,176 KB
testcase_37 AC 75 ms
32,256 KB
testcase_38 AC 40 ms
22,124 KB
testcase_39 AC 66 ms
29,696 KB
testcase_40 AC 67 ms
29,568 KB
testcase_41 AC 34 ms
20,352 KB
testcase_42 AC 37 ms
21,868 KB
testcase_43 AC 27 ms
19,456 KB
testcase_44 AC 28 ms
19,840 KB
testcase_45 AC 27 ms
19,712 KB
testcase_46 AC 28 ms
19,584 KB
testcase_47 AC 28 ms
19,712 KB
testcase_48 AC 27 ms
19,712 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 hs = new HashSet<int>();
        hs.Add(0);
        var b = new int[n];
        b[0] = a[0];
        hs.Add(b[0]);
        for (int i = 1; i < n; i++)
        {
            b[i] = b[i - 1] ^ a[i];
            hs.Add(b[i]);
        }
        getAns(n, k, b, hs);
    }
    static void getAns(int n, int k, int[] b, HashSet<int> hs)
    {
        for (int i = 0; i < n; i++)
        {
            var w = b[i] ^ k;
            if (hs.Contains(w)) { Console.WriteLine("Yes"); return; }
        }
        Console.WriteLine("No");
    }
}
0