結果

問題 No.803 Very Limited Xor Subset
ユーザー 👑 kmjpkmjp
提出日時 2019-03-17 23:53:18
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,529 bytes
コンパイル時間 1,423 ms
コンパイル使用メモリ 166,568 KB
実行使用メモリ 4,680 KB
最終ジャッジ日時 2023-09-22 15:54:15
合計ジャッジ時間 4,081 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,380 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 5 ms
4,376 KB
testcase_04 AC 5 ms
4,380 KB
testcase_05 AC 5 ms
4,376 KB
testcase_06 AC 4 ms
4,376 KB
testcase_07 AC 4 ms
4,376 KB
testcase_08 AC 3 ms
4,376 KB
testcase_09 AC 3 ms
4,376 KB
testcase_10 AC 7 ms
4,376 KB
testcase_11 AC 5 ms
4,380 KB
testcase_12 AC 6 ms
4,380 KB
testcase_13 AC 3 ms
4,380 KB
testcase_14 AC 38 ms
4,376 KB
testcase_15 AC 38 ms
4,376 KB
testcase_16 AC 37 ms
4,432 KB
testcase_17 AC 38 ms
4,380 KB
testcase_18 AC 38 ms
4,380 KB
testcase_19 AC 38 ms
4,376 KB
testcase_20 AC 37 ms
4,376 KB
testcase_21 AC 38 ms
4,376 KB
testcase_22 AC 37 ms
4,380 KB
testcase_23 WA -
testcase_24 AC 37 ms
4,380 KB
testcase_25 AC 37 ms
4,388 KB
testcase_26 AC 36 ms
4,404 KB
testcase_27 AC 36 ms
4,380 KB
testcase_28 AC 37 ms
4,380 KB
testcase_29 AC 36 ms
4,640 KB
testcase_30 AC 36 ms
4,380 KB
testcase_31 AC 37 ms
4,440 KB
testcase_32 AC 37 ms
4,436 KB
testcase_33 AC 37 ms
4,384 KB
testcase_34 AC 2 ms
4,376 KB
testcase_35 AC 35 ms
4,400 KB
testcase_36 AC 24 ms
4,380 KB
testcase_37 AC 30 ms
4,380 KB
testcase_38 AC 7 ms
4,460 KB
testcase_39 AC 7 ms
4,400 KB
testcase_40 AC 35 ms
4,652 KB
testcase_41 WA -
testcase_42 AC 35 ms
4,392 KB
testcase_43 WA -
testcase_44 AC 2 ms
4,376 KB
testcase_45 WA -
testcase_46 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N,M,X;
int A[303];
const int MAT=402;
int mat1[402][402];
int mat2[402][402];
ll mo=1000000007;

int gf2_rank(int A[MAT][MAT],int n) { /* input */
	int i,j,k;
	FOR(i,n) {
		int be=i,mi=n+1;
		for(j=i;j<n;j++) {
			FOR(k,n) if(A[j][k]) break;
			if(k<mi) be=j,mi=k;
		}
		if(mi>=n) break;
		FOR(j,n) swap(A[i][j],A[be][j]);
		
		FOR(j,n) if(i!=j&&A[j][mi]) {
			FOR(k,n) A[j][k] ^= A[i][k];
		}
	}
	return i;
}

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>M>>X;
	FOR(i,N) cin>>A[i];
	FOR(i,30) {
		FOR(j,N) if(A[j]&(1<<i)) mat1[i][j]=mat2[i][j]=1;
		if(X&(1<<i)) mat2[i][N]=1;
	}
	FOR(i,M) {
		cin>>r>>x>>y;
		x--,y--;
		for(j=x;j<=y;j++) mat1[30+i][j]=mat2[30+i][j]=1;
		mat2[30+i][N]=r;
	}
	
	int r1=gf2_rank(mat1,402);
	int r2=gf2_rank(mat1,402);
	if(r1!=r2) return _P("0\n");
	ll ret=1;
	FOR(i,N-r1) ret=ret*2%mo;
	cout<<ret<<endl;
	
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}
0