結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー k3079kk3079k
提出日時 2019-09-15 15:08:51
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 804 ms / 5,000 ms
コード長 892 bytes
コンパイル時間 2,643 ms
コンパイル使用メモリ 62,800 KB
実行使用メモリ 24,732 KB
最終ジャッジ日時 2023-09-15 14:32:00
合計ジャッジ時間 8,279 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
20,880 KB
testcase_01 AC 56 ms
24,732 KB
testcase_02 AC 57 ms
20,656 KB
testcase_03 AC 55 ms
20,584 KB
testcase_04 AC 55 ms
20,636 KB
testcase_05 AC 58 ms
20,588 KB
testcase_06 AC 55 ms
22,696 KB
testcase_07 AC 719 ms
19,016 KB
testcase_08 AC 721 ms
20,884 KB
testcase_09 AC 512 ms
22,908 KB
testcase_10 AC 608 ms
21,012 KB
testcase_11 AC 778 ms
21,136 KB
testcase_12 AC 58 ms
20,800 KB
testcase_13 AC 55 ms
20,584 KB
testcase_14 AC 802 ms
20,912 KB
testcase_15 AC 804 ms
20,980 KB
testcase_16 AC 57 ms
20,608 KB
testcase_17 AC 227 ms
20,976 KB
testcase_18 AC 704 ms
22,924 KB
testcase_19 AC 143 ms
22,736 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;

namespace Test01
{
    class Program
    {
        
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string[] input = Console.ReadLine().Split(' ');

            int[] a = new int[N + 1];
            for (int i = 1; i <= N; i++) a[i] = int.Parse(input[i - 1]);

            int max = 32767;
            bool[] dp = new bool[max + 1];
            dp[0] = true;
            for(int i = 1; i <= N; i++)
            {
                for(int j = 0; j <= max; j++)
                {
                    if ((j ^ a[i]) <= max) dp[j ^ a[i]] |= dp[j];
                }
            }

            int cnt = 0;
            for(int j = 0; j <= max; j++)
            {
                if (dp[j]) cnt++;
            }
            Console.WriteLine(cnt);
        }
    }
}
0