結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー nebukuro09nebukuro09
提出日時 2016-11-28 16:43:43
言語 D
(dmd 2.106.1)
結果
WA  
実行時間 -
コード長 756 bytes
コンパイル時間 682 ms
コンパイル使用メモリ 107,948 KB
実行使用メモリ 35,496 KB
最終ジャッジ日時 2023-09-02 23:10:37
合計ジャッジ時間 9,310 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

import std.stdio;
import std.array;
import std.string;
import std.conv;
import std.algorithm;
import std.typecons;
import std.range;
import std.random;
import std.math;
import std.container;
import std.numeric;
import std.bigint;


void main() {
  auto N = readln.chomp.to!int;
  auto A = readln.split.map!(to!long);
  auto M = new int[][](N, 61);
  long ans = 0;
  foreach (i, a; enumerate(A))
    foreach (j; 0..61) 
      M[i][j] = (A[i] >> j) % 2;

  foreach (i; 0..N) {
    if (M[i][i] == 0)
      foreach (j; i+1..N)
        if (M[j][i] == 1)
          swap(M[i], M[j]);
    if (M[i][i] == 0) continue;

    ans += 1;
    foreach (j; i+1..N)
      if (M[j][i] == 1)
        foreach (k; i..N)
          (M[j][k] ^= M[i][k]);
  }
  writeln(2L^^ans);
}
0