結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー nebukuro09nebukuro09
提出日時 2016-11-28 17:06:33
言語 D
(dmd 2.106.1)
結果
WA  
実行時間 -
コード長 1,072 bytes
コンパイル時間 682 ms
コンパイル使用メモリ 108,800 KB
実行使用メモリ 37,348 KB
最終ジャッジ日時 2023-09-02 23:12:03
合計ジャッジ時間 15,225 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 WA -
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 511 ms
24,872 KB
testcase_09 AC 103 ms
7,252 KB
testcase_10 AC 385 ms
20,116 KB
testcase_11 AC 273 ms
15,640 KB
testcase_12 AC 633 ms
30,936 KB
testcase_13 AC 692 ms
31,628 KB
testcase_14 AC 361 ms
19,524 KB
testcase_15 AC 753 ms
32,528 KB
testcase_16 AC 615 ms
27,596 KB
testcase_17 AC 675 ms
33,064 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 404 ms
32,776 KB
testcase_21 AC 781 ms
37,348 KB
testcase_22 AC 785 ms
34,512 KB
testcase_23 AC 1 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 1 ms
4,376 KB
testcase_26 AC 1 ms
4,380 KB
testcase_27 AC 1 ms
4,380 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 774 ms
32,436 KB
testcase_34 AC 755 ms
32,628 KB
testcase_35 AC 772 ms
33,436 KB
testcase_36 AC 740 ms
33,324 KB
権限があれば一括ダウンロードができます

ソースコード

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);
  foreach (i, a; enumerate(A))
    foreach (j; 0..61) 
      M[i][j] = (A[i] >> j) % 2;

  foreach (i; 0..min(61,N)) {
    //M.each!(writeln);
    //writeln;
    if (M[i][i] == 0) {
      auto mi = i;
      auto m = 60;
      foreach (j; i..N)
        foreach (k; i..61) 
          if (M[j][k] == 1) {
            if (k < m) {
              mi = j;
              m = k;
            }
            break;
          }
      swap(M[i], M[mi]);
    }
    if (M[i][i] == 0) continue;

    foreach (j; i+1..N)
      if (M[j][i] == 1)
        foreach (k; i..61) {
          (M[j][k] ^= M[i][k]);
        }
  }

  int i = N - 1;
  long ans = N;
  while (i >= 0 && M[i].sum == 0) {
    i -= 1;
    ans -= 1;
  }
  writeln(2L^^ans);
}
0