結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー りあん
提出日時 2015-04-19 01:06:20
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 558 ms / 5,000 ms
コード長 2,204 bytes
コンパイル時間 906 ms
コンパイル使用メモリ 112,116 KB
実行使用メモリ 59,144 KB
最終ジャッジ日時 2024-07-04 11:08:55
合計ジャッジ時間 11,282 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 34
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Generic;
using System.Linq;
using System.IO;
using System.Text;

namespace Solver
{
    class Program
    {
        const int M = 1000000007;
        static void Main()
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Scan sc = new Scan();
            int n = sc.Int();
            long[] a = sc.LongArray();
            var set = new SortedSet<long>();
            foreach (long i in a)
                set.Add(i);

            for (int t = 0; t < 100; ++t)
            {
                long pre = 0;
                var l = new SortedSet<long>();
                foreach (long i in set)
                {
                    l.Add(Math.Min(i, pre ^ i));
                    pre = i;
                }
                set.Clear();
                foreach (long i in l)
                    set.Add(i);
            }

            sw.WriteLine((long)1 << set.Count);
            sw.Flush();
        }
    }

    class Scan
    {
        public int Int()
        {
            return int.Parse(Console.ReadLine().Trim());
        }
        public long Long()
        {
            return long.Parse(Console.ReadLine().Trim());
        }
        public string Str()
        {
            return Console.ReadLine().Trim();
        }

        public int[] IntArray()
        {
            return Console.ReadLine().Trim().Split().Select(int.Parse).ToArray();
        }
        public void IntTwi(out int a, out int b)
        {
            int[] arr = IntArray();
            a = arr[0];
            b = arr[1];
        }
        public void LongTwi(out long a, out long b)
        {
            long[] arr = LongArray();
            a = arr[0];
            b = arr[1];
        }
        public void StrTwi(out string a, out string b)
        {
            string[] arr = StrArray();
            a = arr[0];
            b = arr[1];
        }

        public long[] LongArray()
        {
            return Console.ReadLine().Trim().Split().Select(long.Parse).ToArray();
        }
        public string[] StrArray()
        {
            return Console.ReadLine().Trim().Split();
        }
    }
}
0