結果

問題 No.803 Very Limited Xor Subset
ユーザー pekempeypekempey
提出日時 2019-03-20 22:32:30
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 89 ms / 2,000 ms
コード長 1,357 bytes
コンパイル時間 773 ms
コンパイル使用メモリ 78,872 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-19 04:36:32
合計ジャッジ時間 4,617 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 60 ms
4,348 KB
testcase_15 AC 63 ms
4,348 KB
testcase_16 AC 62 ms
4,348 KB
testcase_17 AC 62 ms
4,348 KB
testcase_18 AC 64 ms
4,348 KB
testcase_19 AC 61 ms
4,348 KB
testcase_20 AC 59 ms
4,348 KB
testcase_21 AC 61 ms
4,348 KB
testcase_22 AC 63 ms
4,348 KB
testcase_23 AC 84 ms
4,348 KB
testcase_24 AC 82 ms
4,348 KB
testcase_25 AC 80 ms
4,348 KB
testcase_26 AC 79 ms
4,348 KB
testcase_27 AC 81 ms
4,348 KB
testcase_28 AC 80 ms
4,348 KB
testcase_29 AC 79 ms
4,348 KB
testcase_30 AC 77 ms
4,348 KB
testcase_31 AC 83 ms
4,348 KB
testcase_32 AC 80 ms
4,348 KB
testcase_33 AC 89 ms
4,348 KB
testcase_34 AC 2 ms
4,348 KB
testcase_35 AC 43 ms
4,348 KB
testcase_36 AC 14 ms
4,348 KB
testcase_37 AC 21 ms
4,348 KB
testcase_38 AC 6 ms
4,348 KB
testcase_39 AC 5 ms
4,348 KB
testcase_40 AC 39 ms
4,348 KB
testcase_41 AC 48 ms
4,348 KB
testcase_42 AC 49 ms
4,348 KB
testcase_43 AC 42 ms
4,348 KB
testcase_44 AC 2 ms
4,348 KB
testcase_45 AC 2 ms
4,348 KB
testcase_46 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <bitset>
 
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); i++)

const int MOD = 1e9 + 7;

struct mint {
    int n;
    mint(int n_ = 0) : n(n_) {}
};

mint operator+(mint a, mint b) { a.n += b.n; if (a.n >= MOD) a.n -= MOD; return a; }
mint operator-(mint a, mint b) { a.n -= b.n; if (a.n < 0) a.n += MOD; return a; }
mint operator*(mint a, mint b) { return (long long)a.n * b.n % MOD; }
mint &operator+=(mint &a, mint b) { return a = a + b; }
mint &operator-=(mint &a, mint b) { return a = a - b; }
mint &operator*=(mint &a, mint b) { return a = a * b; }

struct lin {
  vector<bitset<301>> B;

  void insert(bitset<301> a) {
    for (auto x : B) if ((a ^ x).to_string() < a.to_string()) a ^= x;
    if (a.any()) B.push_back(a);
  }
};

int main() {
  int N, M, X;
  cin >> N >> M >> X;
  vector<int> A(N);
  REP(i, N) cin >> A[i];
  lin S, T;
  REP(i, 30) {
    bitset<301> x;
    REP(j, N) x[j] = A[j] >> i & 1;
    S.insert(x);
    x[300] = X >> i & 1;
    T.insert(x);
  }
  REP(i, M) {
    int t, l, r;
    cin >> t >> l >> r;
    bitset<301> x;
    for (int i = l - 1; i < r; i++) x[i] = 1;
    S.insert(x);
    x[300] = t;
    T.insert(x);
  }
  mint ans = 1;
  REP(i, N - S.B.size()) ans *= 2;
  if (S.B.size() != T.B.size()) ans = 0;
  cout << ans.n << '\n';
}
0