結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー bluemegane
提出日時 2021-05-17 18:50:33
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 704 bytes
コンパイル時間 2,278 ms
コンパイル使用メモリ 106,112 KB
実行使用メモリ 37,376 KB
最終ジャッジ日時 2024-10-06 21:50:39
合計ジャッジ時間 5,546 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 RE * 1
other AC * 7 RE * 27
権限があれば一括ダウンロードができます
コンパイルメッセージ
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