結果

問題 No.1716 Bonus Nim
ユーザー ks2mks2m
提出日時 2021-10-22 21:40:39
言語 Java21
(openjdk 21)
結果
AC  
実行時間 844 ms / 2,000 ms
コード長 991 bytes
コンパイル時間 2,127 ms
コンパイル使用メモリ 78,548 KB
実行使用メモリ 87,292 KB
最終ジャッジ日時 2023-10-24 12:40:10
合計ジャッジ時間 16,272 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
53,660 KB
testcase_01 AC 51 ms
53,656 KB
testcase_02 AC 52 ms
53,668 KB
testcase_03 AC 52 ms
53,656 KB
testcase_04 AC 689 ms
74,004 KB
testcase_05 AC 632 ms
84,336 KB
testcase_06 AC 642 ms
79,136 KB
testcase_07 AC 789 ms
78,752 KB
testcase_08 AC 635 ms
77,840 KB
testcase_09 AC 648 ms
82,848 KB
testcase_10 AC 615 ms
81,800 KB
testcase_11 AC 754 ms
77,300 KB
testcase_12 AC 686 ms
82,964 KB
testcase_13 AC 782 ms
81,996 KB
testcase_14 AC 771 ms
76,760 KB
testcase_15 AC 572 ms
65,152 KB
testcase_16 AC 53 ms
53,652 KB
testcase_17 AC 52 ms
52,688 KB
testcase_18 AC 53 ms
53,660 KB
testcase_19 AC 53 ms
52,644 KB
testcase_20 AC 52 ms
53,668 KB
testcase_21 AC 53 ms
53,660 KB
testcase_22 AC 752 ms
80,716 KB
testcase_23 AC 807 ms
82,160 KB
testcase_24 AC 704 ms
87,292 KB
testcase_25 AC 761 ms
81,164 KB
testcase_26 AC 844 ms
82,004 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int t = Integer.parseInt(br.readLine());
		PrintWriter pw = new PrintWriter(System.out);
		for (int z = 0; z < t; z++) {
			int n = Integer.parseInt(br.readLine());
			String[] sa = br.readLine().split(" ");
			int[] a = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = Integer.parseInt(sa[i]);
			}

			Map<Integer, Integer> map = new HashMap<>();
			for (int i = 0; i < n; i++) {
				map.put(a[i], map.getOrDefault(a[i], 0) + 1);
			}
			boolean flg = true;
			for (int v : map.values()) {
				if (v % 2 == 1) {
					flg = false;
					break;
				}
			}
			if (n % 2 == 0 && flg) {
				pw.println("Bob");
			} else {
				pw.println("Alice");
			}
		}
		br.close();
		pw.flush();
	}
}
0