結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー syoken_desukasyoken_desuka
提出日時 2015-04-17 00:55:46
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 8,295 bytes
コンパイル時間 2,411 ms
コンパイル使用メモリ 110,536 KB
実行使用メモリ 64,656 KB
最終ジャッジ日時 2023-09-17 16:27:23
合計ジャッジ時間 40,214 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
20,936 KB
testcase_01 AC 66 ms
20,848 KB
testcase_02 AC 65 ms
20,888 KB
testcase_03 AC 66 ms
20,728 KB
testcase_04 AC 66 ms
22,836 KB
testcase_05 AC 66 ms
20,848 KB
testcase_06 AC 65 ms
20,916 KB
testcase_07 AC 65 ms
20,852 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 65 ms
20,884 KB
testcase_20 AC 198 ms
23,992 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 65 ms
18,772 KB
testcase_25 AC 66 ms
20,888 KB
testcase_26 AC 64 ms
18,864 KB
testcase_27 AC 66 ms
20,800 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

#region ZIPPER
using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using sc = Scanner;
using System.Numerics;
//using Geometry;
//using gl = Geometry.GeometryLibrary;
class Program
{
    static void Main(string[] args)
    {
        Solver solver = new Solver();
        solver.Solve();
#if DEBUG
        System.Console.WriteLine("続行するには何かキーを押してください...");
        System.Console.ReadKey();
#endif

    }
}
/// <summary>
/// 標準入力読み取り支援,自作(某最速の人を参考)
/// </summary>

#endregion ZIPPER

public class Solver
{
    #region IGNORE_ME
    public Solver()
    {
        //こんすとらくたん きにしなくてよろしい
    }
    #endregion IGNORE_ME

    public int MOD = 1000000007;//10^9 + 7

    public void Solve()
    {
        int n = sc.NextInt(); ;
        BigInteger[] aa = new BigInteger[n];

        for (int i = 0; i < n; i++)
        {
            aa[i] =  new BigInteger(sc.NextLong());
        }
        int rank = 0;//これが答えをくれる
        long neglector = 0;//簡約化済を拾わないように
        BigInteger max = 1 << 62;//oomeni
        max *= 1 <<4;
        for (long i = 1; i < max; i *= 2)
        {
            for (int j = 0; j < aa.Length; j++)
            {
                if (((aa[j] & i) != 0))
                {
                    if (i == 1 | ((aa[j] & neglector) == 0)) // kanyakuka ga hituyou
                    {
#if DEBUG
                        Console.WriteLine("grab {0}", aa[j]);
#endif 
                        for (int k = 0; k < aa.Length; k++)
                        {
                            if (k != j && ((aa[k] & i) != 0))
                            {
                                aa[k] = aa[j] ^ aa[k];                         
                            }
                        }
                        rank++;
                        break;
                    }
                }
            }
            neglector += i;
            /*
                foreach (var item in aa)
                {
#if DEBUG
                    Console.WriteLine(item);
#endif 
                }
                Console.WriteLine("");*/
        }
        Console.WriteLine(((BigInteger)1) << rank);
        /* tmp2
        int[] a = sc.NextIntArray();
        HashSet<int>[] sem = new HashSet<int>[2];
        sem[0] = new HashSet<int>();
        sem[1] = new HashSet<int>();
        sem[0].Add(0);
        for (int i = 0; i < a.Length; i++)
        {
            foreach (int item in sem[i % 2])
            {
                sem[(i + 1) % 2].Add(item ^ a[i]);
                sem[(i + 1) % 2].Add(item );
            }
        }
        Console.WriteLine(sem[(a.Length)%2].Count);*/
        /*
        int n = sc.NextInt();
        int[] arr = sc.NextIntArray();
        Array.Sort(arr);
        int tmp = 0;
        int renew = arr[0];
        if (arr.Length == 1)
        {
            Console.WriteLine(1);
        }
        int[] table = new int[50000];
        table[0] = 1;
        for (int i = 1; i < arr.Length; i++)
        {
            if (renew != arr[i])
            {
                renew = arr[i];
                tmp++;
            }
                table[tmp]++;
        }
        int answer = 0;
        for (int i = 0; i < table.Length; i++)
        {
            if (table[i] == 1)
            {
                answer++;
            }
            else if (table[i] == 0)
            {
                break;
            }
        }
        Console.WriteLine(answer);*/
#if DEBUG
        Console.WriteLine("");//local check
#endif
    }
}


public static class Scanner
{
    public static string NextString()
    {
        string tmp = "";
        while (true)
        {
            int readData;
            string data;
            readData = Console.Read();
            if (readData == -1) //EOF
            {
                break;
            }
            data = char.ConvertFromUtf32(readData);
            if (data == " " || data == "\n")
            {
                break;
            }
            tmp += data;
        }
        return tmp;
    }
    public static int NextInt()
    {
        string tmp = "";
        while (true)
        {
            int readData;
            string data;
            readData = Console.Read();
            if (readData == -1) //EOF
            {
                break;
            }
            data = char.ConvertFromUtf32(readData);
            if (data == " " || data == "\n")
            {
                break;
            }
            tmp += data;
        }
        return int.Parse(tmp);
    }
    public static long NextLong()
    {
        string tmp = "";
        while (true)
        {
            int readData;
            string data;
            readData = Console.Read();
            if (readData == -1) //EOF
            {
                break;
            }
            data = char.ConvertFromUtf32(readData);
            if (data == " " || data == "\n")
            {
                break;
            }
            tmp += data;
        }
        return long.Parse(tmp);
    }
    public static double NextDouble()
    {
        string tmp = "";
        while (true)
        {
            int readData;
            string data;
            readData = Console.Read();
            if (readData == -1) //EOF
            {
                break;
            }
            data = char.ConvertFromUtf32(readData);
            if (data == " " || data == "\n")
            {
                break;
            }
            tmp += data;
        }
        return double.Parse(tmp);
    }

    public static string[] NextStrArray()
    {
        return Console.ReadLine().Split(' ');
    }
    public static int[] NextIntArray()
    {

        string[] s = NextStrArray();
        int[] a = new int[s.Length];
        for (int i = 0; i < a.Length; i++)
        {
            a[i] = int.Parse(s[i]);
        }
        return a;
    }
    public static long[] NextLongArray()
    {
        string[] s = NextStrArray();
        long[] a = new long[s.Length];
        for (int i = 0; i < a.Length; i++)
        {
            a[i] = long.Parse(s[i]);
        }
        return a;
    }
    public static double[] NextDoubleArray()
    {
        string[] s = NextStrArray();
        double[] a = new double[s.Length];
        for (int i = 0; i < a.Length; i++)
        {
            a[i] = double.Parse(s[i]);
        }
        return a;
    }
}
/// <summary>
/// 二次元グリッドなどの文字列で与えられたマップなどで、
/// 手軽にデータ変換を適用するためのクラス
/// </summary>
public static class CharInterpreter
{
    /// <summary>
    /// 変換用辞書
    /// </summary>
    private static Dictionary<char, int> MapToInt = new Dictionary<char, int>(); 
    /// <summary>
    /// 変換法則を追加する
    /// </summary>
    /// <param name="c">char文字</param>
    /// <param name="i">対応する整数値</param>
    public static void AddCorrespondence(char c,int i)
    {
        MapToInt.Add(c,i);
    }
    /// <summary>
    /// 文字列に対して、対応付けされた
    /// 例外処理をしていないので注意
    /// </summary>
    /// <returns>対応対応がなかった場合はバグる;;</returns>
    public static int Inquiry(char c)
    {
        int ret = 0;
        MapToInt.TryGetValue(c, out ret);
        return ret;
    }
    /// <summary>
    /// 指定された変換法則の元でint[,]の二次元平面を生成する
    /// 対応関係がない場合の例外処理をしていないので注意
    /// </summary>
    /// <param name="field">配列の各文字列の長さが全て同じでないとうまく作動しないので注意</param>
    /// <returns> int[ field.length , field[0].length]型の配列 </returns>
    public static int[,] GenerateSquareField(string[] field)
    {
        int[,] ret = new int[field.Length, field[0].Length];
        for (int i = 0; i < field.Length; i++)
        {
            for (int j = 0; j < field[0].Length; j++)
            {
                MapToInt.TryGetValue(field[i][j], out ret[i, j]);
            }
        }
        return ret;
    }
}
0