結果

問題 No.130 XOR Minimax
ユーザー NetSeed
提出日時 2016-02-06 20:32:39
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 704 bytes
コンパイル時間 1,000 ms
コンパイル使用メモリ 106,496 KB
実行使用メモリ 44,160 KB
最終ジャッジ日時 2024-09-21 20:54:08
合計ジャッジ時間 5,113 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17 WA * 4
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Linq;

namespace ConsoleApplication2
{
	class Program
	{
		static void Main(string[] args)
		{
			var mask = Enumerable.Range(0, 32).Select(x => (uint)1 << x).Reverse().ToArray();
			Console.ReadLine();

			var current = Console.ReadLine().Split().Select(x => uint.Parse(x)).ToArray();
			uint[] candidate = new uint[0];



			foreach (var m in mask)
			{
				var currentMax = current.Max();
				candidate = current.Select(x => x ^ m).ToArray();
				var candidateMax = candidate.Max();

				//current = currentMax > candidateMax ? candidate : current;
				if (currentMax > candidateMax)
				{
					current = candidate;
				}
			}

			Console.WriteLine(current.Max());
		}
	}
}
0