結果
問題 |
No.3046 White Tiger vs Monster
|
ユーザー |
|
提出日時 | 2025-03-23 03:07:36 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 180 ms / 2,000 ms |
コード長 | 612 bytes |
コンパイル時間 | 3,457 ms |
コンパイル使用メモリ | 277,052 KB |
実行使用メモリ | 7,328 KB |
最終ジャッジ日時 | 2025-03-23 03:07:49 |
合計ジャッジ時間 | 13,092 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 80 |
ソースコード
#include<bits/stdc++.h> using namespace std; typedef unsigned long long ull; int main(){ int n; ull a[200000],b; cin>>n>>b; for(int i=0;i<n;i++) cin>>a[i]; sort(a,a+n); int d=bit_width(b)-1,cnt=0; ull dp[60]; for(int i=0;i<d;i++) dp[i]=1ll<<i; for(int i=0;i<n;i++){ int tmp=bit_width(a[i])-1; if(tmp<d){ cnt++; b^=a[i]; } if(tmp==d) dp[d]=0; for(int j=0;j<tmp;j++) if(~a[i]>>j&1) dp[tmp]|=dp[j]; if(tmp==d){ if(b==a[i]){ cout<<cnt+1<<endl; return 0; } if(dp[d]>>bit_width(b^a[i])-1&1){ cout<<cnt+1<<endl; return 0; } } } cout<<cnt<<endl; }