結果

問題 No.3046 White Tiger vs Monster
ユーザー okkuukenken
提出日時 2025-03-21 02:01:09
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 447 bytes
コンパイル時間 3,257 ms
コンパイル使用メモリ 273,564 KB
実行使用メモリ 7,328 KB
最終ジャッジ日時 2025-03-22 22:31:47
合計ジャッジ時間 6,688 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 3 WA * 77
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
int n,ans,tmp;
ull a[200000],b;
ull dp[1<<20];
int main(){
	cin>>n>>b;
	if(n>20)
		return 0;
	for(int i=0;i<n;i++)
		cin>>a[i];
	dp[0]=b;
	for(int S=1;S<1<<n;S++)
		dp[S]=-1;
	int ans=0;
	for(ull S=0;S<1<<n;S++){
		if(dp[S]==-1)
			continue;
		ans=max(ans,popcount(S));
		for(int i=0;i<n;i++)
			if(~S>>i&1&&dp[S]>=a[i])
				dp[S|1<<i]=dp[S]^a[i];
	}
	cout<<ans<<endl;
}
0