結果
| 問題 | 
                            No.2666 Decreasing Modulo Nim
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2024-03-08 21:16:52 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 28 ms / 2,000 ms | 
| コード長 | 460 bytes | 
| コンパイル時間 | 463 ms | 
| コンパイル使用メモリ | 64,152 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-09-29 18:54:41 | 
| 合計ジャッジ時間 | 2,816 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 55 | 
ソースコード
#include<iostream>
#include<cassert>
using namespace std;
int N,M,A[2<<17];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cin>>N>>M;
	int X=0;
	for(int i=0;i<N;i++)
	{
		cin>>A[i];
		X^=A[i]/M;
		A[i]%=M;
	}
	if(X!=0)
	{
		cout<<"Alice\n";
		return 0;
	}
	while(true)
	{
		long long sum=0;
		for(int i=0;i<N;i++)
		{
			sum+=A[i];
			A[i]/=2;
		}
		if(sum%2==1)
		{
			cout<<"Alice\n";
			return 0;
		}
		if(sum==0)break;
	}
	cout<<"Bob\n";
}