結果

問題 No.582 キャンディー・ボックス3
ユーザー FromBooskaFromBooska
提出日時 2023-09-25 13:46:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 793 bytes
コンパイル時間 416 ms
コンパイル使用メモリ 86,632 KB
実行使用メモリ 71,172 KB
最終ジャッジ日時 2023-09-25 13:46:13
合計ジャッジ時間 2,997 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,172 KB
testcase_01 AC 71 ms
70,932 KB
testcase_02 AC 70 ms
70,808 KB
testcase_03 AC 72 ms
71,112 KB
testcase_04 AC 72 ms
70,876 KB
testcase_05 AC 71 ms
70,852 KB
testcase_06 AC 71 ms
71,112 KB
testcase_07 AC 71 ms
71,112 KB
testcase_08 AC 70 ms
70,852 KB
testcase_09 AC 71 ms
70,800 KB
testcase_10 AC 70 ms
70,876 KB
testcase_11 AC 69 ms
70,932 KB
testcase_12 AC 73 ms
71,076 KB
testcase_13 AC 69 ms
70,880 KB
testcase_14 AC 70 ms
70,900 KB
testcase_15 AC 71 ms
71,008 KB
testcase_16 AC 72 ms
71,000 KB
testcase_17 AC 71 ms
70,800 KB
testcase_18 AC 72 ms
70,828 KB
testcase_19 AC 69 ms
71,100 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# あれ、グランディ数で解けない、なんでだろう?
# A = [0, 1, 3]でダメだ
# Bが圧倒的に有利、Bが負けるのはどんな初期状態かを考える
# 1が奇数個だけ、または1が奇数個で2が1つ、だけか

N = int(input())
A = list(map(int, input().split()))
count_1 = 0
count_2 = 0
count_3above = 0
for a in A:
    if a == 1:
        count_1 += 1
    elif a == 2:
        count_2 += 1
    elif a >= 3:
        count_3above += 1
nonzero = count_1 + count_2 + count_3above
ans = 'B'
if count_1 == nonzero:
    if count_1%2 == 1:
        ans = 'A'
else:
    if count_2 == 1 and count_1 + count_2 == nonzero and count_1%2 == 1:
        ans = 'A'
print(ans)
#print('count_1', count_1, 'count_2', count_2, 'count_3above', count_3above, 'nonzero', nonzero)
0