結果

問題 No.1594 Three Classes
ユーザー 大橋佐和大橋佐和
提出日時 2022-05-06 21:20:08
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 580 bytes
コンパイル時間 804 ms
コンパイル使用メモリ 86,968 KB
実行使用メモリ 77,240 KB
最終ジャッジ日時 2023-09-20 02:01:19
合計ジャッジ時間 4,933 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 154 ms
77,232 KB
testcase_01 WA -
testcase_02 AC 72 ms
71,584 KB
testcase_03 AC 88 ms
76,720 KB
testcase_04 AC 152 ms
77,240 KB
testcase_05 AC 152 ms
76,984 KB
testcase_06 AC 86 ms
76,316 KB
testcase_07 AC 86 ms
76,752 KB
testcase_08 AC 152 ms
77,052 KB
testcase_09 AC 153 ms
77,200 KB
testcase_10 AC 152 ms
76,852 KB
testcase_11 AC 153 ms
77,140 KB
testcase_12 AC 153 ms
77,148 KB
testcase_13 AC 73 ms
71,268 KB
testcase_14 AC 110 ms
76,380 KB
testcase_15 AC 80 ms
76,624 KB
testcase_16 AC 100 ms
76,656 KB
testcase_17 AC 81 ms
76,344 KB
testcase_18 AC 73 ms
71,244 KB
testcase_19 AC 79 ms
76,512 KB
testcase_20 AC 80 ms
76,560 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
e = list(map(int, input().split()))
total_e = sum(e)

answer = False
for in_A in range(1 << n):
    p_A = 0
    for j in range(n):
        if in_A >> j & 1:
            p_A += e[j]
    ex_A = (1 << n) - in_A
    in_B = ex_A
    while in_B > 0:
        p_B = 0
        for j in range(n):
            if in_B >> j & 1:
                p_B += e[j]
        p_C = total_e - p_A - p_B
        if p_A == p_B and p_B == p_C:
            answer = True
            break
        in_B -= 1
        in_B &= ex_A
    if answer:
        break

print("Yes" if answer else "No")
0