結果

問題 No.1594 Three Classes
ユーザー prd_xxxprd_xxx
提出日時 2021-07-09 21:57:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 87 ms / 2,000 ms
コード長 498 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 87,176 KB
実行使用メモリ 76,556 KB
最終ジャッジ日時 2023-08-10 06:50:50
合計ジャッジ時間 2,869 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
76,556 KB
testcase_01 AC 71 ms
71,396 KB
testcase_02 AC 72 ms
71,012 KB
testcase_03 AC 73 ms
71,208 KB
testcase_04 AC 73 ms
71,324 KB
testcase_05 AC 76 ms
76,460 KB
testcase_06 AC 73 ms
70,860 KB
testcase_07 AC 71 ms
71,188 KB
testcase_08 AC 87 ms
76,552 KB
testcase_09 AC 77 ms
76,000 KB
testcase_10 AC 78 ms
76,464 KB
testcase_11 AC 79 ms
76,000 KB
testcase_12 AC 77 ms
76,512 KB
testcase_13 AC 70 ms
71,360 KB
testcase_14 AC 78 ms
76,348 KB
testcase_15 AC 79 ms
76,472 KB
testcase_16 AC 77 ms
76,188 KB
testcase_17 AC 76 ms
75,848 KB
testcase_18 AC 71 ms
71,320 KB
testcase_19 AC 70 ms
71,116 KB
testcase_20 AC 69 ms
71,232 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