結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー 14番
提出日時 2016-07-17 14:14:17
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 1,653 bytes
コンパイル時間 1,411 ms
コンパイル使用メモリ 107,904 KB
実行使用メモリ 100,352 KB
最終ジャッジ日時 2024-10-15 15:21:38
合計ジャッジ時間 8,567 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 16 RE * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Generic;
using System.Text;
using System.Linq;

class Program
{
    public void Proc()
    {
        Reader.IsDebug = false;
        int switchCount = int.Parse(Reader.ReadLine());
        this.SwitchList = Reader.ReadLine().Split(' ').Select(a=>int.Parse(a)).ToArray();
        this.Dic = new bool[SwitchList.Length, (1<<14)];
        this.GetAns(0, 0);
        Console.WriteLine(this.ans.Count);
    }
    
    private bool[,] Dic;

    private Dictionary<int, bool> ans = new Dictionary<int, bool>();
    private void GetAns(int idx, int num) {
        if(idx == this.SwitchList.Length) {
            if(!ans.ContainsKey(num)) {
                ans.Add(num, true);
            }
            return;
        }
        if(this.Dic[idx, num]) {
            return;
        }
        this.GetAns(idx + 1, num);
        this.GetAns(idx + 1, num ^ SwitchList[idx]);
        this.Dic[idx, num] = true;
    }

    private int[] SwitchList;


    public class Reader
    {
        public static bool IsDebug = true;
        private static String PlainInput = @"


6
1 1 4 5 1 4

 
";
        private static System.IO.StringReader Sr = null;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (Sr == null)
                {
                    Sr = new System.IO.StringReader(PlainInput.Trim());
                }
                return Sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }

    }
    static void Main()
    {
        Program prg = new Program();
        prg.Proc();
    }
}
0