結果
| 問題 | 
                            No.183 たのしい排他的論理和(EASY)
                             | 
                    
| コンテスト | |
| ユーザー | 
                             明智重蔵
                         | 
                    
| 提出日時 | 2015-09-19 18:10:36 | 
| 言語 | C#(csc)  (csc 3.9.0)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                            (最新)
                                AC
                                 
                             
                            (最初)
                            
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,819 bytes | 
| コンパイル時間 | 1,064 ms | 
| コンパイル使用メモリ | 108,800 KB | 
| 実行使用メモリ | 43,728 KB | 
| 最終ジャッジ日時 | 2024-11-08 10:52:39 | 
| 合計ジャッジ時間 | 7,821 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 5 TLE * 1 -- * 12 | 
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
    static string InputPattern = "Input3";
    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();
        if (InputPattern == "Input1") {
            WillReturn.Add("2");
            WillReturn.Add("1 2");
            //4
            //0=0
            //1=0 XOR 1
            //2=0 XOR 2
            //3=0 XOR 1 XOR 2
            //の4種類の値を作ることができます。
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("6");
            WillReturn.Add("1 1 4 5 1 4");
            //4
            //6つ整数が与えられても4種類しか作れない場合もあります
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }
    static void Main()
    {
        List<string> InputList = GetInputList();
        //0 XOR 0 XOR 0 = 0
        //0 XOR 1 XOR 1 = 0
        //1 XOR 0 XOR 0 = 1
        //1 XOR 1 XOR 1 = 1
        //よって、
        //A XOR B XOR B = A なので、
        //重複した値は、Distinctしておく
        int[] AArr = InputList[1].Split(' ').Select(X => int.Parse(X)).Distinct().ToArray();
        //作成可否[整数]なDP表
        var PrevDP = new bool[16384 * 2 + 1];
        PrevDP[0] = true;
        foreach (int EachA in AArr) {
            var CurrDP = (bool[])PrevDP.Clone();
            for (int I = 0; I <= PrevDP.GetUpperBound(0); I++) {
                if (PrevDP[I] == false) continue;
                int wkInd = EachA ^ I;
                CurrDP[wkInd] = true;
            }
            PrevDP = CurrDP;
        }
        Console.WriteLine(PrevDP.Count(X => X));
    }
}
            
            
            
        
            
明智重蔵