結果
| 問題 | 
                            No.2666 Decreasing Modulo Nim
                             | 
                    
| コンテスト | |
| ユーザー | 
                             nikoro256
                         | 
                    
| 提出日時 | 2024-03-09 00:26:26 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 243 ms / 2,000 ms | 
| コード長 | 548 bytes | 
| コンパイル時間 | 206 ms | 
| コンパイル使用メモリ | 82,036 KB | 
| 実行使用メモリ | 131,244 KB | 
| 最終ジャッジ日時 | 2024-09-29 21:02:14 | 
| 合計ジャッジ時間 | 7,826 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 55 | 
ソースコード
from collections import defaultdict
N,M=map(int,input().split())
A=list(map(int,input().split()))
nim=0
dic=defaultdict(int)
div=0
for i in range(N):
    nim^=(A[i]//M)
    if A[i]%M>0:
        dic[A[i]%M]+=1
        div+=A[i]%M
if nim>0:
    print('Alice')
    exit(0)
#和を奇数にしたら勝ち。
if div%2==1:
    print('Alice')
    exit(0)
left=2
for i in range(30):
    if left>M:
        break
    nim2=0
    for i in range(N):
        nim2+=(A[i]%M//left)
    if nim2%2>0:
        print('Alice')
        exit(0)
    left*=2
print('Bob')
            
            
            
        
            
nikoro256