結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー 14番14番
提出日時 2016-07-17 14:14:17
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 1,653 bytes
コンパイル時間 1,060 ms
コンパイル使用メモリ 112,628 KB
実行使用メモリ 110,304 KB
最終ジャッジ日時 2024-04-23 15:02:06
合計ジャッジ時間 8,124 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
25,516 KB
testcase_01 AC 28 ms
25,604 KB
testcase_02 AC 29 ms
25,436 KB
testcase_03 AC 27 ms
25,580 KB
testcase_04 AC 28 ms
27,244 KB
testcase_05 AC 28 ms
27,496 KB
testcase_06 AC 27 ms
25,464 KB
testcase_07 RE -
testcase_08 AC 931 ms
101,692 KB
testcase_09 AC 646 ms
82,736 KB
testcase_10 AC 776 ms
89,068 KB
testcase_11 AC 988 ms
105,180 KB
testcase_12 AC 32 ms
28,268 KB
testcase_13 AC 28 ms
27,528 KB
testcase_14 AC 52 ms
46,872 KB
testcase_15 AC 1,015 ms
110,304 KB
testcase_16 AC 28 ms
25,576 KB
testcase_17 AC 250 ms
47,520 KB
testcase_18 RE -
testcase_19 AC 140 ms
35,820 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.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