結果

問題 No.1594 Three Classes
ユーザー ainem-mainem-m
提出日時 2021-07-10 12:24:57
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 529 bytes
コンパイル時間 72 ms
コンパイル使用メモリ 10,816 KB
実行使用メモリ 8,236 KB
最終ジャッジ日時 2023-09-14 18:51:14
合計ジャッジ時間 2,066 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
7,756 KB
testcase_01 AC 17 ms
7,784 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 16 ms
8,236 KB
testcase_05 AC 28 ms
7,856 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 34 ms
7,756 KB
testcase_09 AC 27 ms
7,820 KB
testcase_10 AC 28 ms
7,932 KB
testcase_11 AC 28 ms
7,940 KB
testcase_12 AC 28 ms
7,832 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 16 ms
8,144 KB
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = [int(i) for i in input().split()]
sum_A = sum(A)
if sum_A%3:
    print("No")
    exit()
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
        for bit in range(1<<n):
            for j in range(n):
                if j in used:break
                if (bit>>j)&1:
                    a += A[j]
        if tmp == a:
            print("Yes")
            exit()
print("No")
0