結果

問題 No.1594 Three Classes
ユーザー 大橋佐和大橋佐和
提出日時 2022-05-06 21:29:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,294 ms / 2,000 ms
コード長 557 bytes
コンパイル時間 418 ms
コンパイル使用メモリ 87,204 KB
実行使用メモリ 77,364 KB
最終ジャッジ日時 2023-08-10 07:14:54
合計ジャッジ時間 14,253 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,289 ms
77,364 KB
testcase_01 AC 74 ms
71,360 KB
testcase_02 AC 73 ms
71,504 KB
testcase_03 AC 116 ms
76,956 KB
testcase_04 AC 1,284 ms
77,124 KB
testcase_05 AC 1,284 ms
77,068 KB
testcase_06 AC 110 ms
76,972 KB
testcase_07 AC 114 ms
77,024 KB
testcase_08 AC 1,279 ms
76,880 KB
testcase_09 AC 1,287 ms
77,272 KB
testcase_10 AC 1,281 ms
77,124 KB
testcase_11 AC 1,294 ms
76,880 KB
testcase_12 AC 1,278 ms
76,920 KB
testcase_13 AC 76 ms
75,884 KB
testcase_14 AC 298 ms
77,060 KB
testcase_15 AC 90 ms
76,532 KB
testcase_16 AC 112 ms
77,048 KB
testcase_17 AC 87 ms
76,600 KB
testcase_18 AC 74 ms
71,492 KB
testcase_19 AC 83 ms
76,752 KB
testcase_20 AC 88 ms
76,852 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

exist = 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) - 1 - in_A
    for in_B in range(1 << n):
        in_B &= ex_A
        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:
            exist = True
            break
    if exist:
        break

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