結果

問題 No.1594 Three Classes
ユーザー prd_xxxprd_xxx
提出日時 2021-07-09 21:57:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 51 ms / 2,000 ms
コード長 498 bytes
コンパイル時間 286 ms
コンパイル使用メモリ 82,212 KB
実行使用メモリ 64,120 KB
最終ジャッジ日時 2024-04-28 00:08:53
合計ジャッジ時間 1,586 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
60,916 KB
testcase_01 AC 34 ms
53,020 KB
testcase_02 AC 33 ms
52,564 KB
testcase_03 AC 33 ms
52,724 KB
testcase_04 AC 33 ms
53,184 KB
testcase_05 AC 39 ms
60,964 KB
testcase_06 AC 34 ms
52,192 KB
testcase_07 AC 34 ms
53,228 KB
testcase_08 AC 51 ms
64,120 KB
testcase_09 AC 41 ms
61,140 KB
testcase_10 AC 38 ms
61,004 KB
testcase_11 AC 39 ms
60,004 KB
testcase_12 AC 39 ms
60,128 KB
testcase_13 AC 32 ms
52,984 KB
testcase_14 AC 40 ms
61,976 KB
testcase_15 AC 38 ms
60,948 KB
testcase_16 AC 37 ms
60,332 KB
testcase_17 AC 37 ms
58,908 KB
testcase_18 AC 31 ms
53,064 KB
testcase_19 AC 31 ms
52,508 KB
testcase_20 AC 32 ms
52,552 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