結果

問題 No.1716 Bonus Nim
ユーザー nok0nok0
提出日時 2021-06-04 23:34:10
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 354 ms / 2,000 ms
コード長 409 bytes
コンパイル時間 2,029 ms
コンパイル使用メモリ 205,976 KB
実行使用メモリ 4,528 KB
最終ジャッジ日時 2023-10-24 11:23:20
合計ジャッジ時間 9,952 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 239 ms
4,348 KB
testcase_05 AC 241 ms
4,528 KB
testcase_06 AC 241 ms
4,348 KB
testcase_07 AC 243 ms
4,508 KB
testcase_08 AC 242 ms
4,348 KB
testcase_09 AC 240 ms
4,348 KB
testcase_10 AC 241 ms
4,348 KB
testcase_11 AC 241 ms
4,348 KB
testcase_12 AC 241 ms
4,348 KB
testcase_13 AC 243 ms
4,436 KB
testcase_14 AC 242 ms
4,348 KB
testcase_15 AC 354 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 AC 2 ms
4,348 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 AC 2 ms
4,348 KB
testcase_22 AC 243 ms
4,348 KB
testcase_23 AC 240 ms
4,348 KB
testcase_24 AC 239 ms
4,348 KB
testcase_25 AC 241 ms
4,348 KB
testcase_26 AC 242 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
	int t;
	cin >> t;
	while(t--) {
		int n;
		cin >> n;
		vector<int> a(n);
		for(auto &v : a) cin >> v;
		sort(a.begin(), a.end());
		if(n & 1) {
			cout << "Alice\n";
		} else {
			bool notpair = 0;
			for(int i = 0; i < n / 2; i++) {
				if(a[i * 2] != a[i * 2 + 1]) notpair = 1;
			}
			cout << (notpair ? "Alice\n" : "Bob\n");
		}
	}
	return 0;
}
0