結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー eitahoeitaho
提出日時 2015-04-17 14:42:46
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 2,639 bytes
コンパイル時間 2,487 ms
コンパイル使用メモリ 109,068 KB
実行使用メモリ 47,428 KB
最終ジャッジ日時 2023-09-17 16:33:40
合計ジャッジ時間 9,025 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
21,844 KB
testcase_01 AC 67 ms
23,884 KB
testcase_02 AC 67 ms
23,836 KB
testcase_03 WA -
testcase_04 AC 67 ms
21,820 KB
testcase_05 AC 67 ms
23,896 KB
testcase_06 WA -
testcase_07 AC 67 ms
23,884 KB
testcase_08 AC 164 ms
42,224 KB
testcase_09 AC 91 ms
22,564 KB
testcase_10 AC 139 ms
34,676 KB
testcase_11 AC 121 ms
30,236 KB
testcase_12 AC 177 ms
45,976 KB
testcase_13 AC 185 ms
45,124 KB
testcase_14 AC 135 ms
32,200 KB
testcase_15 AC 195 ms
45,568 KB
testcase_16 AC 177 ms
45,696 KB
testcase_17 AC 181 ms
47,428 KB
testcase_18 AC 66 ms
21,884 KB
testcase_19 AC 64 ms
21,752 KB
testcase_20 AC 106 ms
29,124 KB
testcase_21 AC 197 ms
44,700 KB
testcase_22 AC 197 ms
44,512 KB
testcase_23 WA -
testcase_24 AC 67 ms
19,848 KB
testcase_25 AC 67 ms
21,968 KB
testcase_26 AC 68 ms
23,804 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 180 ms
46,592 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 176 ms
44,708 KB
testcase_33 AC 196 ms
43,692 KB
testcase_34 AC 193 ms
46,088 KB
testcase_35 AC 198 ms
46,448 KB
testcase_36 AC 197 ms
44,532 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.IO;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using System.Diagnostics;
using System.Numerics;
using Enu = System.Linq.Enumerable;

class Program
{
    public void Solve()
    {
        int N = Reader.Int();
        var A = Enu.Range(0, N).Select(i => Reader.Long()).Distinct().ToArray();
        N = A.Length;
        int rank = 0;

        for (int shift = 0; shift < Math.Min(61, N); shift++)
        {
            int p = Array.FindIndex(A, shift, a => (a >> shift & 1) == 1);
            if (p < 0) continue;
            Swap(ref A[rank], ref A[p]);
            rank++;
            for (int i = rank + 1; i < N; i++)
                if ((A[i] >> shift & 1) == 1)
                    A[i] ^= A[p];
        }
        long ans = 1L << rank;
        Console.WriteLine(ans);
    }

    static void Swap<T>(ref T a, ref T b) { T t = a; a = b; b = t; }
}

class Entry { static void Main() { new Program().Solve(); } }
class Reader
{
    private static TextReader reader = Console.In;
    private static readonly char[] separator = { ' ' };
    private static readonly StringSplitOptions op = StringSplitOptions.RemoveEmptyEntries;
    private static string[] A = new string[0];
    private static int i;
    private static void Init() { A = new string[0]; }
    public static void Set(TextReader r) { reader = r; Init(); }
    public static void Set(string file) { reader = new StreamReader(file); Init(); }
    public static bool HasNext() { return CheckNext(); }
    public static string String() { return Next(); }
    public static int Int() { return int.Parse(Next()); }
    public static long Long() { return long.Parse(Next()); }
    public static double Double() { return double.Parse(Next()); }
    public static int[] IntLine() { return Array.ConvertAll(Split(Line()), int.Parse); }
    public static int[] IntArray(int N) { return Enu.Range(0, N).Select(i => Int()).ToArray(); }
    public static int[][] IntTable(int H) { return Enu.Range(0, H).Select(i => IntLine()).ToArray(); }
    public static string[] StringArray(int N) { return Enu.Range(0, N).Select(i => Line()).ToArray(); }
    public static string Line() { return reader.ReadLine().Trim(); }
    private static string[] Split(string s) { return s.Split(separator, op); }
    private static string Next() { CheckNext(); return A[i++]; }
    private static bool CheckNext()
    {
        if (i < A.Length) return true;
        string line = reader.ReadLine();
        if (line == null) return false;
        if (line == "") return CheckNext();
        A = Split(line);
        i = 0;
        return true;
    }
}
0