結果

問題 No.2538 2進元ゲーム
ユーザー AerenAeren
提出日時 2023-11-10 22:55:26
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,321 bytes
コンパイル時間 3,783 ms
コンパイル使用メモリ 264,328 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2023-11-10 22:55:32
合計ジャッジ時間 5,110 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 2 ms
6,676 KB
testcase_07 AC 2 ms
6,676 KB
testcase_08 AC 2 ms
6,676 KB
testcase_09 WA -
testcase_10 AC 2 ms
6,676 KB
testcase_11 AC 2 ms
6,676 KB
testcase_12 AC 2 ms
6,676 KB
testcase_13 AC 2 ms
6,676 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 2 ms
6,676 KB
testcase_18 AC 2 ms
6,676 KB
testcase_19 AC 2 ms
6,676 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 2 ms
6,676 KB
testcase_24 WA -
testcase_25 AC 2 ms
6,676 KB
testcase_26 AC 2 ms
6,676 KB
testcase_27 WA -
testcase_28 AC 2 ms
6,676 KB
testcase_29 AC 2 ms
6,676 KB
testcase_30 AC 4 ms
6,676 KB
testcase_31 AC 20 ms
6,676 KB
testcase_32 AC 135 ms
6,676 KB
testcase_33 AC 137 ms
6,676 KB
testcase_34 AC 88 ms
6,676 KB
testcase_35 AC 19 ms
6,676 KB
testcase_36 AC 57 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
// #include <x86intrin.h>
using namespace std;
using namespace numbers;



int main(){
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(ios::badbit | ios::failbit);
	int n;
	cin >> n;
	vector<long long> a(n);
	copy_n(istream_iterator<long long>(cin), n, a.begin());
	if(ranges::min(a) < 0){
		cout << "1\n";
		return 0;
	}
	vector<int> dp(60);
	auto grundy = [&](long long x)->int{
		vector<int> found;
		for(auto y = 0; 1LL << y <= x; ++ y){
			if(x & 1LL << y){
				found.push_back(dp[y]);
			}
		}
		ranges::sort(found);
		found.erase(unique(found.begin(), found.end()), found.end());
		found.push_back(1e9);
		int res = 0;
		while(res == found[res]){
			++ res;
		}
		return res;
	};
	for(auto x = 1; x < 60; ++ x){
		dp[x] = grundy(x);
	}
	int g = 0;
	for(auto x: a){
		g ^= grundy(x);
	}
	g ? cout << "1\n" : cout << "2\n";
	return 0;
}

/*

*/

////////////////////////////////////////////////////////////////////////////////////////
//                                                                                    //
//                                   Coded by Aeren                                   //
//                                                                                    //
////////////////////////////////////////////////////////////////////////////////////////
0