結果

問題 No.1594 Three Classes
ユーザー hir355hir355
提出日時 2021-07-09 21:26:39
言語 PyPy3
(7.3.8)
結果
AC  
実行時間 172 ms / 2,000 ms
コード長 486 bytes
コンパイル時間 290 ms
使用メモリ 81,616 KB
最終ジャッジ日時 2022-12-17 01:30:46
合計ジャッジ時間 4,916 ms
ジャッジサーバーID
(参考情報)
judge10 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 171 ms
81,500 KB
testcase_01 AC 83 ms
75,492 KB
testcase_02 AC 84 ms
75,756 KB
testcase_03 AC 108 ms
81,180 KB
testcase_04 AC 166 ms
81,420 KB
testcase_05 AC 167 ms
81,396 KB
testcase_06 AC 109 ms
80,884 KB
testcase_07 AC 107 ms
81,116 KB
testcase_08 AC 168 ms
81,616 KB
testcase_09 AC 172 ms
81,324 KB
testcase_10 AC 168 ms
81,180 KB
testcase_11 AC 168 ms
81,376 KB
testcase_12 AC 168 ms
81,600 KB
testcase_13 AC 84 ms
75,764 KB
testcase_14 AC 134 ms
81,588 KB
testcase_15 AC 102 ms
81,060 KB
testcase_16 AC 106 ms
80,720 KB
testcase_17 AC 97 ms
80,912 KB
testcase_18 AC 84 ms
75,520 KB
testcase_19 AC 96 ms
80,772 KB
testcase_20 AC 101 ms
81,048 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