結果

問題 No.1594 Three Classes
ユーザー prd_xxxprd_xxx
提出日時 2021-07-09 21:57:42
言語 PyPy3
(7.3.8)
結果
AC  
実行時間 111 ms / 2,000 ms
コード長 498 bytes
コンパイル時間 276 ms
使用メモリ 81,104 KB
最終ジャッジ日時 2022-12-17 02:00:34
合計ジャッジ時間 3,706 ms
ジャッジサーバーID
(参考情報)
judge14 / judge16
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 98 ms
81,104 KB
testcase_01 AC 93 ms
75,708 KB
testcase_02 AC 92 ms
75,764 KB
testcase_03 AC 92 ms
75,660 KB
testcase_04 AC 90 ms
75,700 KB
testcase_05 AC 98 ms
81,012 KB
testcase_06 AC 90 ms
75,664 KB
testcase_07 AC 91 ms
75,768 KB
testcase_08 AC 111 ms
80,920 KB
testcase_09 AC 99 ms
80,912 KB
testcase_10 AC 100 ms
80,964 KB
testcase_11 AC 101 ms
80,908 KB
testcase_12 AC 99 ms
80,616 KB
testcase_13 AC 91 ms
75,472 KB
testcase_14 AC 101 ms
80,856 KB
testcase_15 AC 98 ms
80,648 KB
testcase_16 AC 101 ms
80,792 KB
testcase_17 AC 100 ms
80,644 KB
testcase_18 AC 93 ms
75,404 KB
testcase_19 AC 92 ms
75,836 KB
testcase_20 AC 91 ms
75,672 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
E = list(map(int,input().split()))
se = sum(E)
s = se//3
if s*3 != se:
    print('No')
    exit()

for a in range(1,1<<N):
    t = 0
    for i in range(N):
        if a&(1<<i):
            t += E[i]
    if t != s: continue
    for b in range(1,1<<N):
        if a&b: continue
        if a|b == 1<<N - 1: continue
        tt = 0
        for i in range(N):
            if b&(1<<i):
                tt += E[i]
        if tt==s:
            print('Yes')
            exit()
print('No')
0