結果
問題 | No.183 たのしい排他的論理和(EASY) |
ユーザー |
![]() |
提出日時 | 2015-04-17 22:30:37 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 40 ms / 5,000 ms |
コード長 | 2,081 bytes |
コンパイル時間 | 1,784 ms |
コンパイル使用メモリ | 107,648 KB |
実行使用メモリ | 21,888 KB |
最終ジャッジ日時 | 2024-06-29 01:47:01 |
合計ジャッジ時間 | 3,236 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 |
コンパイルメッセージ
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.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(); } } }