結果

問題 No.1594 Three Classes
ユーザー DrDrpilotDrDrpilot
提出日時 2022-01-24 17:25:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 152 ms / 2,000 ms
コード長 352 bytes
コンパイル時間 168 ms
コンパイル使用メモリ 82,248 KB
実行使用メモリ 76,156 KB
最終ジャッジ日時 2024-04-28 00:46:14
合計ジャッジ時間 2,692 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 143 ms
75,592 KB
testcase_01 AC 34 ms
51,968 KB
testcase_02 AC 34 ms
51,968 KB
testcase_03 AC 46 ms
64,256 KB
testcase_04 AC 146 ms
75,648 KB
testcase_05 AC 147 ms
76,132 KB
testcase_06 AC 42 ms
60,800 KB
testcase_07 AC 44 ms
62,080 KB
testcase_08 AC 142 ms
75,520 KB
testcase_09 AC 144 ms
75,652 KB
testcase_10 AC 146 ms
75,648 KB
testcase_11 AC 142 ms
76,156 KB
testcase_12 AC 152 ms
76,032 KB
testcase_13 AC 35 ms
53,060 KB
testcase_14 AC 59 ms
72,396 KB
testcase_15 AC 56 ms
71,424 KB
testcase_16 AC 47 ms
65,280 KB
testcase_17 AC 46 ms
64,128 KB
testcase_18 AC 34 ms
51,712 KB
testcase_19 AC 41 ms
61,184 KB
testcase_20 AC 42 ms
60,800 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import product
n=int(input())
a=list(map(int,input().split()))
f=False
for bit in product(range(3),repeat=n):
    x=y=z=0
    for i in range(n):
        if bit[i]==0:
            x+=a[i]
        elif bit[i]==1:
            y+=a[i]
        else:
            z+=a[i]
    if x==y==z:
        f=True
        break
print('Yes' if f else 'No')
0