結果

問題 No.1594 Three Classes
ユーザー shinichishinichi
提出日時 2021-07-09 22:00:34
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 651 bytes
コンパイル時間 313 ms
コンパイル使用メモリ 87,124 KB
実行使用メモリ 77,024 KB
最終ジャッジ日時 2023-09-14 09:02:19
合計ジャッジ時間 2,953 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
76,904 KB
testcase_01 WA -
testcase_02 AC 65 ms
71,280 KB
testcase_03 AC 75 ms
76,516 KB
testcase_04 AC 66 ms
71,116 KB
testcase_05 AC 87 ms
76,920 KB
testcase_06 AC 69 ms
75,076 KB
testcase_07 AC 81 ms
76,808 KB
testcase_08 WA -
testcase_09 AC 80 ms
77,024 KB
testcase_10 AC 79 ms
76,820 KB
testcase_11 AC 83 ms
76,628 KB
testcase_12 AC 85 ms
76,624 KB
testcase_13 AC 65 ms
71,460 KB
testcase_14 AC 86 ms
76,928 KB
testcase_15 AC 109 ms
76,840 KB
testcase_16 AC 78 ms
76,732 KB
testcase_17 AC 108 ms
76,944 KB
testcase_18 AC 63 ms
71,252 KB
testcase_19 AC 65 ms
71,520 KB
testcase_20 AC 70 ms
75,284 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math, sys

N = int(input())
E = list(map(int, input().split()))

if sum(E) % 3:
    print('No')
    sys.exit()



for bit in range(2**N):
    A, B, C = [], [], []
    rest = []
    for i in range(N):
        if (bit >> i) & 1:
            A.append(E[i])
        else:
            rest.append(E[i])
    if sum(A) == sum(E) // 3:
        for bit in range(2**len(rest)):
            for j in range(len(rest)):
                if (bit >> j) & 1:
                    B.append(rest[j])
                else:
                    C.append(rest[j])
            if sum(B) == sum(C):
                print('Yes')
                sys.exit()
print('No')



0