結果
問題 | No.3046 White Tiger vs Monster |
ユーザー |
|
提出日時 | 2025-03-23 04:02:11 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 1,623 ms / 2,000 ms |
コード長 | 442 bytes |
コンパイル時間 | 423 ms |
コンパイル使用メモリ | 12,288 KB |
実行使用メモリ | 31,540 KB |
最終ジャッジ日時 | 2025-03-23 04:02:48 |
合計ジャッジ時間 | 35,928 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 80 |
ソースコード
import sys def main(): n,b=map(int,input().split()) a=list(map(int,input().split())) a.sort() d=b.bit_length() cnt=0 dp=[0]*(d+1) for i in range(d): dp[i]=1<<i; for i in a: tmp=i.bit_length() if tmp<d: cnt+=1 b^=i if tmp==d: dp[d]=1 if tmp>d: break for j in range(1,tmp): if (i>>j-1&1)==0: dp[tmp]|=dp[j] if tmp==d: if dp[d]>>(b^i).bit_length()&1: print(cnt+1) sys.exit() print(cnt) main()