結果

問題 No.1594 Three Classes
ユーザー nohakai3nohakai3
提出日時 2022-11-05 11:59:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 677 ms / 2,000 ms
コード長 331 bytes
コンパイル時間 291 ms
コンパイル使用メモリ 87,112 KB
実行使用メモリ 78,424 KB
最終ジャッジ日時 2023-09-26 11:44:24
合計ジャッジ時間 9,284 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 677 ms
77,920 KB
testcase_01 AC 72 ms
71,344 KB
testcase_02 AC 71 ms
71,272 KB
testcase_03 AC 130 ms
77,600 KB
testcase_04 AC 658 ms
78,108 KB
testcase_05 AC 657 ms
78,424 KB
testcase_06 AC 87 ms
75,484 KB
testcase_07 AC 118 ms
77,600 KB
testcase_08 AC 671 ms
77,920 KB
testcase_09 AC 660 ms
77,948 KB
testcase_10 AC 667 ms
77,952 KB
testcase_11 AC 662 ms
77,972 KB
testcase_12 AC 664 ms
78,048 KB
testcase_13 AC 71 ms
71,124 KB
testcase_14 AC 178 ms
77,840 KB
testcase_15 AC 169 ms
77,628 KB
testcase_16 AC 138 ms
77,916 KB
testcase_17 AC 126 ms
77,524 KB
testcase_18 AC 71 ms
71,156 KB
testcase_19 AC 122 ms
77,808 KB
testcase_20 AC 110 ms
77,396 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
A=list(map(int,input().split()))
from itertools import product
for bits in product([0,1,2],repeat=n):
    a=[x for bit,x in zip(bits,A) if bit==0]
    b=[x for bit,x in zip(bits,A) if bit==1]
    c=[x for bit,x in zip(bits,A) if bit==2]
    if sum(a)==sum(b)==sum(c):
        print("Yes")
        exit()

print("No")
0