結果

問題 No.130 XOR Minimax
ユーザー NetSeedNetSeed
提出日時 2016-02-06 21:44:31
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,150 bytes
コンパイル時間 872 ms
コンパイル使用メモリ 111,008 KB
実行使用メモリ 54,216 KB
最終ジャッジ日時 2023-10-21 19:33:16
合計ジャッジ時間 6,781 ms
ジャッジサーバーID
(参考情報)
judge11 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 36 ms
25,444 KB
testcase_02 AC 35 ms
25,452 KB
testcase_03 AC 35 ms
25,452 KB
testcase_04 AC 337 ms
48,328 KB
testcase_05 AC 358 ms
54,216 KB
testcase_06 AC 344 ms
50,156 KB
testcase_07 WA -
testcase_08 AC 359 ms
52,592 KB
testcase_09 AC 85 ms
29,480 KB
testcase_10 AC 109 ms
32,120 KB
testcase_11 AC 297 ms
48,664 KB
testcase_12 AC 60 ms
27,044 KB
testcase_13 AC 246 ms
48,020 KB
testcase_14 AC 307 ms
49,296 KB
testcase_15 AC 42 ms
25,944 KB
testcase_16 AC 226 ms
48,212 KB
testcase_17 AC 233 ms
48,516 KB
testcase_18 AC 250 ms
48,516 KB
testcase_19 AC 291 ms
49,088 KB
testcase_20 AC 156 ms
37,144 KB
testcase_21 AC 304 ms
49,088 KB
testcase_22 AC 93 ms
30,492 KB
testcase_23 AC 55 ms
26,968 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.IO;
using System.Linq;


namespace ConsoleApplication2
{
	class Program
	{
		static void Main(string[] args)
		{
#if LOCAL
			Console.SetIn(new StreamReader("test18.txt"));
#endif
			var mask = Enumerable.Range(0, 32).Select(x => (uint)1 << x).Reverse().ToArray();
			Console.ReadLine();

			var original = Console.ReadLine().Split().Select(x => uint.Parse(x)).ToArray();
			var currentA = original.ToArray();
			var currentB = original.ToArray();

			uint[] candidate = new uint[0];



			foreach (var m in mask)
			{
				var currentMax = currentA.Max();

				candidate = currentA.Select(x => x ^ m).ToArray();
				var candidateMax = candidate.Max();

				if (currentMax > candidateMax)
				{
					currentA = candidate;
				}
			}

			foreach (var m in mask.Reverse())
			{
				var currentMax = currentB.Max();

				candidate = currentB.Select(x => x ^ m).ToArray();
				var candidateMax = candidate.Max();

				if (currentMax > candidateMax)
				{
					currentB = candidate;
				}

			}

			Console.WriteLine(Math.Min(currentA.Max(), currentB.Max()));
		}
	}
}
0