結果

問題 No.1594 Three Classes
ユーザー ainem-mainem-m
提出日時 2021-07-09 22:15:47
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 603 bytes
コンパイル時間 114 ms
コンパイル使用メモリ 10,972 KB
実行使用メモリ 7,976 KB
最終ジャッジ日時 2023-09-14 09:29:00
合計ジャッジ時間 1,485 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = [int(i) for i in input().split()]
if sum_A%3:
    print("No")
    exit()
sum_A = sum(A)
for bit in range(1<<n):
    tmp = 0
    used = []
    for i in range(n):
        if (bit>>i)&1:
            tmp += A[i]
            used.append(i)
    if tmp == sum_A//3:
        a = 0
        b = 0
        for bit in range(1<<n):
            for j in range(n):
                if j in used:continue
                if (bit>>j)&1:
                    a += A[j]
                else:
                    b += A[j]
        if tmp == a == b:
            print("Yes")
            exit()
print("No")
0