結果

問題 No.803 Very Limited Xor Subset
ユーザー jelljell
提出日時 2019-07-11 16:12:47
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 1,348 bytes
コンパイル時間 1,394 ms
コンパイル使用メモリ 164,604 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-25 10:36:08
合計ジャッジ時間 2,842 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;
using pll = pair<i64,i64>;
#define fir first
#define sec second
#define mod 1000000007

void ios_untie() {
    ios::sync_with_stdio(false);
    cin.tie(0);
}

int n,m;
int mt[334][334];

signed main() {
    ios_untie();

    int X;
    cin>>n>>m>>X;
    for(int j=0; j<30; ++j,X>>=1) {
        mt[j][n]=X&1;
    }
    for(int i=0,a; i<n; ++i) {
        cin>>a;
        for(int j=0; j<30; ++j,a>>=1) {
            mt[j][i]=a&1;
        }
    }
    for(int i=0; i<m; ++i) {
        int t,l,r; cin>>t>>l>>r;
        mt[i+30][n]=t;
        for(int j=l-1; j<r; ++j) {
            mt[i+30][j]=1;
        }
    }
    m+=30;
    int rank=0;
    int last=-1;
    for(int i=0; i<=n; ++i) {
        for(int j=rank; j<m; ++j) {
            if(mt[j][i]) {
                last=i;
                for(int k=j+1; k<m; ++k) {
                    if(mt[k][i]) {
                        for(int h=i; h<=n; ++h) {
                            mt[k][h]^=mt[j][h];
                        }
                    }
                }
                swap(mt[rank],mt[j]);
                rank++;
                break;
            }
        }
    }
    int ans=0;
    if(last!=n) {
        ans=1;
        for(int i=0; i<n-rank; ++i) {
            ans=ans*2%mod;
        }
    }
    cout<<ans<<endl;
}
0