結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー te-shte-sh
提出日時 2016-09-12 16:21:18
言語 D
(dmd 2.107.1)
結果
AC  
実行時間 91 ms / 5,000 ms
コード長 648 bytes
コンパイル時間 702 ms
コンパイル使用メモリ 108,412 KB
実行使用メモリ 8,692 KB
最終ジャッジ日時 2023-09-02 22:05:27
合計ジャッジ時間 4,351 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,372 KB
testcase_01 AC 1 ms
4,368 KB
testcase_02 AC 1 ms
4,368 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,368 KB
testcase_06 AC 1 ms
4,372 KB
testcase_07 AC 1 ms
4,368 KB
testcase_08 AC 64 ms
6,464 KB
testcase_09 AC 15 ms
4,372 KB
testcase_10 AC 49 ms
6,140 KB
testcase_11 AC 36 ms
5,888 KB
testcase_12 AC 74 ms
6,380 KB
testcase_13 AC 79 ms
6,964 KB
testcase_14 AC 46 ms
6,008 KB
testcase_15 AC 87 ms
7,256 KB
testcase_16 AC 72 ms
6,700 KB
testcase_17 AC 77 ms
7,004 KB
testcase_18 AC 1 ms
4,372 KB
testcase_19 AC 2 ms
4,368 KB
testcase_20 AC 27 ms
5,300 KB
testcase_21 AC 90 ms
7,016 KB
testcase_22 AC 90 ms
6,804 KB
testcase_23 AC 1 ms
4,368 KB
testcase_24 AC 2 ms
4,368 KB
testcase_25 AC 1 ms
4,372 KB
testcase_26 AC 1 ms
4,372 KB
testcase_27 AC 2 ms
4,368 KB
testcase_28 AC 55 ms
5,864 KB
testcase_29 AC 76 ms
7,236 KB
testcase_30 AC 66 ms
6,520 KB
testcase_31 AC 57 ms
6,204 KB
testcase_32 AC 71 ms
6,384 KB
testcase_33 AC 87 ms
8,352 KB
testcase_34 AC 87 ms
6,984 KB
testcase_35 AC 91 ms
8,692 KB
testcase_36 AC 88 ms
7,184 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.algorithm, std.array, std.container, std.range, std.bitmanip;
import std.numeric, std.math, std.bigint, std.random, core.bitop;
import std.string, std.regex, std.conv, std.stdio, std.typecons;

void main()
{
  auto n = readln.chomp.to!size_t;
  auto ai = readln.split.map!(to!long).array;

  size_t i = 0;
  foreach (j; 0..61) {
    if (i >= n) break;
    auto k = ai[i..$].countUntil!(a => (a & (1L << j)) != 0);
    if (k == -1) continue;
    swap(ai[i], ai[k + i]);
    foreach (l; i + 1..n) {
      if ((ai[l] & (1L << j)) != 0)
        ai[l] ^= ai[i];
    }
    i += 1;
  }

  auto r = ai.count!(a => a != 0);
  writeln(2L ^^ r);
}
0