結果

問題 No.3460 Chocolate Divide Game
コンテスト
ユーザー startcpp
提出日時 2026-02-28 15:18:55
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 580 ms / 2,000 ms
コード長 635 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 745 ms
コンパイル使用メモリ 84,968 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2026-02-28 15:19:33
合計ジャッジ時間 5,367 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <set>
#define rep(i, n) for(i = 0; i < n; i++)
#define int long long
using namespace std;

int dp[100000];
int f(int n) {
	if (n == 1) return 0;
	if (dp[n] != -1) return dp[n];

	set<int> st;
	for (int i = 1; i <= n / 2; i++) {
		st.insert(f(n - i));
	}

	int g;
	for (g = 0; st.find(g) != st.end(); g++);
	return dp[n] = g;
}

signed main() {
	int T;
	cin >> T;
	while (T--) {
		int n; cin >> n;
		
		bool second = false;
		for (int i = 0; i < 60; i++) {
			if ((1LL << i) - 1 == n) { second = true; break; }
		}
		if (second) { cout << "Bob" << endl; }
		else { cout << "Alice" << endl; }
	}
	return 0;
}
0