結果

問題 No.1594 Three Classes
ユーザー somey-svsomey-sv
提出日時 2021-07-10 01:17:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 115 ms / 2,000 ms
コード長 575 bytes
コンパイル時間 166 ms
コンパイル使用メモリ 82,392 KB
実行使用メモリ 76,196 KB
最終ジャッジ日時 2024-04-28 00:35:06
合計ジャッジ時間 2,429 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 114 ms
76,076 KB
testcase_01 AC 35 ms
52,344 KB
testcase_02 AC 34 ms
52,588 KB
testcase_03 AC 54 ms
65,512 KB
testcase_04 AC 111 ms
75,884 KB
testcase_05 AC 112 ms
75,860 KB
testcase_06 AC 55 ms
66,692 KB
testcase_07 AC 55 ms
66,256 KB
testcase_08 AC 115 ms
75,736 KB
testcase_09 AC 112 ms
76,196 KB
testcase_10 AC 112 ms
75,920 KB
testcase_11 AC 112 ms
76,124 KB
testcase_12 AC 111 ms
75,864 KB
testcase_13 AC 37 ms
52,752 KB
testcase_14 AC 82 ms
76,036 KB
testcase_15 AC 50 ms
64,820 KB
testcase_16 AC 53 ms
66,216 KB
testcase_17 AC 47 ms
63,636 KB
testcase_18 AC 35 ms
52,752 KB
testcase_19 AC 45 ms
62,048 KB
testcase_20 AC 48 ms
64,960 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
E = list(map(int, input().split()))

ALL1 = 1 << N

for i in range(ALL1):
    E1 = 0
    rest = []
    for j in range(N):
        if i & 1 << j:
            E1 += E[j]
        else:
            rest.append(j)
    
    ALL2 = 1 << len(rest)

    for i2 in range(ALL2):
        E2 = 0
        E3 = 0
        for j2 in range(len(rest)):
            if i2 & 1 << j2:
                E2 += E[rest[j2]]
            else:
                E3 += E[rest[j2]]
                
        if E1 == E2 == E3:
            print("Yes")
            exit()

        
print("No")
0