結果
問題 | No.183 たのしい排他的論理和(EASY) |
ユーザー | 明智重蔵 |
提出日時 | 2015-09-19 18:10:36 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,819 bytes |
コンパイル時間 | 947 ms |
コンパイル使用メモリ | 114,692 KB |
実行使用メモリ | 57,332 KB |
最終ジャッジ日時 | 2024-04-25 22:45:14 |
合計ジャッジ時間 | 7,952 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 41 ms
27,480 KB |
testcase_01 | AC | 41 ms
25,564 KB |
testcase_02 | AC | 70 ms
27,428 KB |
testcase_03 | AC | 65 ms
27,320 KB |
testcase_04 | AC | 44 ms
25,260 KB |
testcase_05 | AC | 72 ms
25,280 KB |
testcase_06 | AC | 52 ms
25,388 KB |
testcase_07 | TLE | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
コンパイルメッセージ
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)); } }