結果

問題 No.1594 Three Classes
ユーザー hir355hir355
提出日時 2021-07-09 21:26:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 122 ms / 2,000 ms
コード長 486 bytes
コンパイル時間 132 ms
コンパイル使用メモリ 82,516 KB
実行使用メモリ 76,160 KB
最終ジャッジ日時 2024-04-27 23:53:44
合計ジャッジ時間 2,432 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 108 ms
75,996 KB
testcase_01 AC 35 ms
51,840 KB
testcase_02 AC 34 ms
51,840 KB
testcase_03 AC 59 ms
65,408 KB
testcase_04 AC 120 ms
75,904 KB
testcase_05 AC 112 ms
75,904 KB
testcase_06 AC 62 ms
65,408 KB
testcase_07 AC 58 ms
64,896 KB
testcase_08 AC 122 ms
76,032 KB
testcase_09 AC 106 ms
75,940 KB
testcase_10 AC 117 ms
76,160 KB
testcase_11 AC 108 ms
76,088 KB
testcase_12 AC 118 ms
75,648 KB
testcase_13 AC 35 ms
52,592 KB
testcase_14 AC 79 ms
75,904 KB
testcase_15 AC 52 ms
63,232 KB
testcase_16 AC 56 ms
65,152 KB
testcase_17 AC 50 ms
62,720 KB
testcase_18 AC 34 ms
52,096 KB
testcase_19 AC 47 ms
61,568 KB
testcase_20 AC 50 ms
62,848 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