結果
問題 |
No.130 XOR Minimax
|
ユーザー |
![]() |
提出日時 | 2016-02-06 21:44:31 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,150 bytes |
コンパイル時間 | 915 ms |
コンパイル使用メモリ | 114,640 KB |
実行使用メモリ | 53,076 KB |
最終ジャッジ日時 | 2024-09-21 20:55:17 |
合計ジャッジ時間 | 6,715 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 WA * 2 |
コンパイルメッセージ
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; 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())); } } }