結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー te-shte-sh
提出日時 2016-09-12 16:16:24
言語 D
(dmd 2.106.1)
結果
WA  
実行時間 -
コード長 654 bytes
コンパイル時間 930 ms
コンパイル使用メモリ 108,752 KB
実行使用メモリ 8,220 KB
最終ジャッジ日時 2023-09-02 22:04:58
合計ジャッジ時間 4,702 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,372 KB
testcase_01 AC 1 ms
4,372 KB
testcase_02 AC 1 ms
4,368 KB
testcase_03 AC 2 ms
4,368 KB
testcase_04 AC 1 ms
4,368 KB
testcase_05 AC 1 ms
4,372 KB
testcase_06 AC 1 ms
4,368 KB
testcase_07 AC 2 ms
4,368 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 1 ms
4,368 KB
testcase_19 AC 1 ms
4,368 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 2 ms
4,368 KB
testcase_24 AC 1 ms
4,368 KB
testcase_25 AC 1 ms
4,368 KB
testcase_26 AC 1 ms
4,368 KB
testcase_27 AC 1 ms
4,368 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
権限があれば一括ダウンロードができます

ソースコード

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 & (1 << j)) != 0);
    if (k == -1) continue;
    swap(ai[i], ai[k + i]);
    foreach (l; i + 1..min(n, 61)) {
      if ((ai[l] & (1 << j)) != 0)
        ai[l] ^= ai[i];
    }
    i += 1;
  }

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