結果
問題 | No.184 たのしい排他的論理和(HARD) |
ユーザー | 紙ぺーぱー |
提出日時 | 2015-04-13 06:09:21 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 204 ms / 5,000 ms |
コード長 | 1,891 bytes |
コンパイル時間 | 3,107 ms |
コンパイル使用メモリ | 101,328 KB |
実行使用メモリ | 33,692 KB |
最終ジャッジ日時 | 2023-09-17 16:17:19 |
合計ジャッジ時間 | 8,818 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 62 ms
15,540 KB |
testcase_01 | AC | 61 ms
15,396 KB |
testcase_02 | AC | 61 ms
15,432 KB |
testcase_03 | AC | 62 ms
15,436 KB |
testcase_04 | AC | 62 ms
15,396 KB |
testcase_05 | AC | 61 ms
15,600 KB |
testcase_06 | AC | 61 ms
15,444 KB |
testcase_07 | AC | 62 ms
15,396 KB |
testcase_08 | AC | 163 ms
30,864 KB |
testcase_09 | AC | 87 ms
17,532 KB |
testcase_10 | AC | 136 ms
24,100 KB |
testcase_11 | AC | 118 ms
21,744 KB |
testcase_12 | AC | 181 ms
31,980 KB |
testcase_13 | AC | 189 ms
32,688 KB |
testcase_14 | AC | 133 ms
23,468 KB |
testcase_15 | AC | 196 ms
33,300 KB |
testcase_16 | AC | 178 ms
31,768 KB |
testcase_17 | AC | 184 ms
32,448 KB |
testcase_18 | AC | 61 ms
15,440 KB |
testcase_19 | AC | 62 ms
15,604 KB |
testcase_20 | AC | 92 ms
20,964 KB |
testcase_21 | AC | 204 ms
33,692 KB |
testcase_22 | AC | 201 ms
33,612 KB |
testcase_23 | AC | 63 ms
15,392 KB |
testcase_24 | AC | 63 ms
15,336 KB |
testcase_25 | AC | 62 ms
15,496 KB |
testcase_26 | AC | 63 ms
15,440 KB |
testcase_27 | AC | 63 ms
15,572 KB |
testcase_28 | AC | 144 ms
24,968 KB |
testcase_29 | AC | 183 ms
32,248 KB |
testcase_30 | AC | 170 ms
31,232 KB |
testcase_31 | AC | 160 ms
29,820 KB |
testcase_32 | AC | 177 ms
31,812 KB |
testcase_33 | AC | 196 ms
33,292 KB |
testcase_34 | AC | 195 ms
33,140 KB |
testcase_35 | AC | 199 ms
33,504 KB |
testcase_36 | AC | 198 ms
33,440 KB |
コンパイルメッセージ
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; static public class Program { static public void Main() { var n = readInteger().Validate(x => 1 <= x && x <= 100000); var a = readLong(n).ValidateArray(x => 1 <= x && x <= 1L << 60); readEOF(); var b = new List<long>[65]; for (int i = 0; i < 65; i++) b[i] = new List<long>(); foreach (var x in a) { var v = x; for (int i = 0; i < 64 && 0 < v; i++) { if ((v >> i & 1) == 0) continue; if (b[i].Count > 0) v ^= b[i][0]; else { b[i].Add(v); break; } } } Console.WriteLine(1L << b.Count(x => x.Count > 0)); } static int readInteger() { var s = Console.ReadLine(); return int.Parse(s); } static long[] readLong(int n) { var s = Console.ReadLine().Split(' '); if (s.Length != n) throw new Exception(string.Format("invalid input, expected{0} actual{1}", n, s.Length)); var ret = new long[n]; for (int i = 0; i < n; i++) ret[i] = long.Parse(s[i]); return ret; } static void readEOF() { if (Console.In.Peek() >= 0) throw new Exception("invalid input too long input file"); } } static public class Ex { static public T Validate<T>(this T input, Func<T, bool> f) { if (!f(input)) throw new Exception("invalid input"); return input; } static public T[] ValidateArray<T>(this T[] input, Func<T, bool> f) { foreach (var x in input) if (!f(x)) throw new Exception("invalid input"); return input; } }