結果

問題 No.803 Very Limited Xor Subset
ユーザー tempura_pp
提出日時 2019-03-14 21:03:00
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 671 bytes
コンパイル時間 1,733 ms
コンパイル使用メモリ 168,108 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-27 06:41:05
合計ジャッジ時間 9,582 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 14 RE * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
const ll mod=1e9+7 ;

int main(){
	int n,m,k;
	cin>>n>>m>>k;
	assert(n<=24);
	int a[n];
	rep(i,n)cin>>a[i];
	pair<int,pair<int,int>> p[m];
	rep(i,m)cin>>p[i].first>>p[i].second.first>>p[i].second.second;
	int all=1<<n;
	int ans=0;
	rep(i,all){
		int ret=0;
		rep(j,n)if((1<<j)&i)ret^=a[j];
		if(ret!=k)continue;
		bool ok=true;
		rep(j,m){
			int cnt=0;
			REP(k,p[j].second.first-1,p[j].second.second){
				if((1<<k)&i)++cnt;
			}
			if(cnt%2!=p[j].first)ok=false;
		}
		ans+=ok;
	}
	cout<<ans<<endl;
	return 0;
}
0