結果

問題 No.1594 Three Classes
ユーザー convexineqconvexineq
提出日時 2021-07-09 21:27:55
言語 PyPy3
(7.3.8)
結果
AC  
実行時間 92 ms / 2,000 ms
コード長 310 bytes
コンパイル時間 296 ms
使用メモリ 80,836 KB
最終ジャッジ日時 2022-12-17 01:32:41
合計ジャッジ時間 3,382 ms
ジャッジサーバーID
(参考情報)
judge10 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 92 ms
80,760 KB
testcase_01 AC 84 ms
75,744 KB
testcase_02 AC 83 ms
75,660 KB
testcase_03 AC 89 ms
80,556 KB
testcase_04 AC 83 ms
75,716 KB
testcase_05 AC 92 ms
80,468 KB
testcase_06 AC 91 ms
80,704 KB
testcase_07 AC 92 ms
80,712 KB
testcase_08 AC 91 ms
80,552 KB
testcase_09 AC 89 ms
80,836 KB
testcase_10 AC 90 ms
80,640 KB
testcase_11 AC 91 ms
80,728 KB
testcase_12 AC 91 ms
80,640 KB
testcase_13 AC 82 ms
75,728 KB
testcase_14 AC 88 ms
80,756 KB
testcase_15 AC 87 ms
80,624 KB
testcase_16 AC 88 ms
80,676 KB
testcase_17 AC 89 ms
80,708 KB
testcase_18 AC 82 ms
75,648 KB
testcase_19 AC 82 ms
75,744 KB
testcase_20 AC 86 ms
80,748 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
*a, = map(int,input().split())
K = sum(a)
if K%3:
    print("No")
    exit()
K //= 3

r = [0]
for ai in a:
    r += [x+ai for x in r]

for S in range(1<<n):
    T = S
    while T:
        if r[T] == r[S] - r[T] == K:
            print("Yes")
            exit()
        T = S&(T-1)

print("No")
0