結果

問題 No.1594 Three Classes
ユーザー ainem-mainem-m
提出日時 2021-07-10 03:56:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 603 bytes
コンパイル時間 94 ms
コンパイル使用メモリ 10,840 KB
実行使用メモリ 8,048 KB
最終ジャッジ日時 2023-09-14 16:07:33
合計ジャッジ時間 3,892 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
7,808 KB
testcase_01 AC 16 ms
7,720 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 16 ms
8,040 KB
testcase_05 AC 28 ms
7,796 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 73 ms
7,788 KB
testcase_09 AC 28 ms
7,848 KB
testcase_10 AC 28 ms
7,932 KB
testcase_11 AC 28 ms
7,788 KB
testcase_12 AC 28 ms
7,880 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,048 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
        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