結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー りあんりあん
提出日時 2015-04-17 22:30:37
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 77 ms / 5,000 ms
コード長 2,081 bytes
コンパイル時間 2,875 ms
コンパイル使用メモリ 104,780 KB
実行使用メモリ 24,780 KB
最終ジャッジ日時 2023-09-11 11:05:35
合計ジャッジ時間 4,554 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
22,768 KB
testcase_01 AC 65 ms
24,664 KB
testcase_02 AC 66 ms
22,692 KB
testcase_03 AC 65 ms
24,780 KB
testcase_04 AC 65 ms
22,804 KB
testcase_05 AC 66 ms
20,856 KB
testcase_06 AC 64 ms
22,728 KB
testcase_07 AC 76 ms
24,004 KB
testcase_08 AC 75 ms
23,832 KB
testcase_09 AC 75 ms
23,844 KB
testcase_10 AC 76 ms
23,708 KB
testcase_11 AC 77 ms
23,868 KB
testcase_12 AC 68 ms
23,656 KB
testcase_13 AC 64 ms
22,704 KB
testcase_14 AC 73 ms
23,064 KB
testcase_15 AC 76 ms
23,820 KB
testcase_16 AC 66 ms
22,704 KB
testcase_17 AC 75 ms
23,532 KB
testcase_18 AC 77 ms
23,976 KB
testcase_19 AC 75 ms
23,084 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.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();
            var set = new HashSet<int>();
            int n = sc.Int();
            int[] a = sc.IntArray();
            set.Add(0);
            foreach (int i in a)
            {
                if (set.Add(i))
                {
                    var l = new List<int>();
                    foreach (int j in set)
                        l.Add(j ^ i);

                    foreach (int j in l)
                        set.Add(j);
                }
            }
            sw.WriteLine(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