結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー bluemeganebluemegane
提出日時 2021-05-17 18:50:33
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 704 bytes
コンパイル時間 1,232 ms
コンパイル使用メモリ 106,496 KB
実行使用メモリ 37,248 KB
最終ジャッジ日時 2024-04-16 07:25:46
合計ジャッジ時間 5,767 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
18,816 KB
testcase_01 AC 30 ms
19,072 KB
testcase_02 RE -
testcase_03 AC 37 ms
19,072 KB
testcase_04 AC 39 ms
18,944 KB
testcase_05 AC 40 ms
18,944 KB
testcase_06 AC 31 ms
18,944 KB
testcase_07 AC 44 ms
18,944 KB
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 AC 30 ms
19,072 KB
testcase_20 AC 61 ms
23,680 KB
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System.Linq;
using System;

public class Hello
{
    static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, int.Parse);
        a = a.Distinct().ToArray();
        getAns(n, a);
    }
    static void getAns (int n, int [] a)
    {
        var imax = a.Max() * 2;
        var b = new bool[imax + 1];
        b[0] = true;
        foreach (var x in  a)
        {
            for (int i = imax ; i >= 0; i--)
            {
                if (b[i]) b[i ^ x] = true;
            }
        }
        var count = b.Count(x => x == true);
        Console.WriteLine(count);
    }
}
0