結果
| 問題 | No.184 たのしい排他的論理和(HARD) |
| コンテスト | |
| ユーザー |
りあん
|
| 提出日時 | 2015-04-19 02:39:10 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 561 ms / 5,000 ms |
| コード長 | 2,283 bytes |
| 記録 | |
| コンパイル時間 | 855 ms |
| コンパイル使用メモリ | 112,888 KB |
| 実行使用メモリ | 61,328 KB |
| 最終ジャッジ日時 | 2024-07-04 11:39:52 |
| 合計ジャッジ時間 | 11,737 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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.
ソースコード
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 HashSet<long>();
foreach (long i in a)
set.Add(i);
for (int t = 0; t < 100; ++t)
set = loop(set, t);
sw.WriteLine((long)1 << set.Count);
sw.Flush();
}
public static HashSet<long> loop (HashSet<long> set, int t)
{
var ret = new HashSet<long>();
long p = set.ElementAt(t % set.Count());
foreach (long i in set)
{
if (i == p)
ret.Add(i);
else
ret.Add(Math.Min(i, p ^ i));
}
return ret;
}
}
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();
}
}
}
りあん