結果

問題 No.1594 Three Classes
ユーザー hir355hir355
提出日時 2021-07-09 21:26:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 152 ms / 2,000 ms
コード長 486 bytes
コンパイル時間 450 ms
コンパイル使用メモリ 87,264 KB
実行使用メモリ 77,232 KB
最終ジャッジ日時 2023-08-10 06:35:49
合計ジャッジ時間 3,699 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 151 ms
77,108 KB
testcase_01 AC 69 ms
71,180 KB
testcase_02 AC 69 ms
71,404 KB
testcase_03 AC 91 ms
76,548 KB
testcase_04 AC 151 ms
77,116 KB
testcase_05 AC 145 ms
77,196 KB
testcase_06 AC 89 ms
76,392 KB
testcase_07 AC 89 ms
76,640 KB
testcase_08 AC 150 ms
77,172 KB
testcase_09 AC 148 ms
77,192 KB
testcase_10 AC 150 ms
77,132 KB
testcase_11 AC 152 ms
77,232 KB
testcase_12 AC 151 ms
77,196 KB
testcase_13 AC 71 ms
71,128 KB
testcase_14 AC 119 ms
77,196 KB
testcase_15 AC 87 ms
76,544 KB
testcase_16 AC 90 ms
76,508 KB
testcase_17 AC 83 ms
76,600 KB
testcase_18 AC 70 ms
71,596 KB
testcase_19 AC 80 ms
76,616 KB
testcase_20 AC 84 ms
76,496 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
e = list(map(int, input().split()))
for i in range(1 << n):
    a = 0
    t = []
    for j in range(n):
        if (i >> j) & 1:
            a += e[j]
        else:
            t.append(j)
    for j in range(1 << len(t)):
        b, c = 0, 0
        for k in range(len(t)):
            if (j >> k) & 1:
                b += e[t[k]]
            else:
                c += e[t[k]]
        if a == b == c:
            print('Yes')
            exit(0)
else:
    print('No')
0