結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー mbanmban
提出日時 2017-01-12 13:26:44
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 1,964 bytes
コンパイル時間 2,378 ms
コンパイル使用メモリ 110,368 KB
実行使用メモリ 44,420 KB
最終ジャッジ日時 2023-08-23 08:44:38
合計ジャッジ時間 11,789 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
21,404 KB
testcase_01 AC 61 ms
21,436 KB
testcase_02 AC 61 ms
23,456 KB
testcase_03 AC 62 ms
23,468 KB
testcase_04 AC 61 ms
21,420 KB
testcase_05 AC 63 ms
23,388 KB
testcase_06 AC 61 ms
21,444 KB
testcase_07 RE -
testcase_08 AC 1,274 ms
42,320 KB
testcase_09 AC 901 ms
44,268 KB
testcase_10 AC 1,072 ms
42,408 KB
testcase_11 AC 1,387 ms
42,324 KB
testcase_12 RE -
testcase_13 AC 60 ms
21,372 KB
testcase_14 AC 225 ms
23,884 KB
testcase_15 AC 1,440 ms
44,420 KB
testcase_16 AC 61 ms
23,476 KB
testcase_17 AC 371 ms
42,104 KB
testcase_18 RE -
testcase_19 AC 216 ms
41,844 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
using System.IO;

class Program
{
    static private Magatro M = new Magatro();
    static private void Main(string[]args)
    {
        M.Scan();
        M.Solve();
    }
}

public class Scanner
{
    private string[] S;
    private int Index;
    private char Separator;

    public Scanner(char separator = ' ')
    {
        Index = 0;
        Separator = separator;
    }

    private string[] Line()
    {
        return Console.ReadLine().Split(Separator);
    }

    public string Next()
    {
        string result;
        if (S == null || Index >= S.Length)
        {
            S = Line();
            Index = 0;
        }
        result = S[Index];
        Index++;
        return result;
    }
    public int NextInt()
    {
        return int.Parse(Next());
    }
    public double NextDouble()
    {
        return double.Parse(Next());
    }
    public long NextLong()
    {
        return long.Parse(Next());
    }
}

public class Magatro
{
    private int N;
    private int[] A;
    private const int Max = 1<<14;
    public void Scan()
    {
        Scanner sc = new Scanner();
        N = sc.NextInt();
        A = new int[N];
        for(int i = 0; i < N; i++)
        {
            A[i] = sc.NextInt();
        }
    }
    public void Solve()
    {
        bool[] dp = new bool[Max + 1];
        dp[0] = true;
        for(int i = 0; i < N; i++)
        {
            List<int> next = new List<int>();

            for(int j = 0; j <= Max; j++)
            {
                if (dp[j])
                {
                    next.Add(j ^ A[i]);
                }
            }
            for(int j = 0; j < next.Count; j++)
            {
                dp[next[j]] = true;
            }
        }
        Console.WriteLine(dp.Count(ss =>ss));
    }
}
0