結果

問題 No.1594 Three Classes
ユーザー DrDrpilotDrDrpilot
提出日時 2022-01-24 17:25:19
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,967 ms / 2,000 ms
コード長 352 bytes
コンパイル時間 76 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-04-28 00:46:51
合計ジャッジ時間 19,234 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,873 ms
10,752 KB
testcase_01 AC 31 ms
10,752 KB
testcase_02 AC 30 ms
10,624 KB
testcase_03 AC 101 ms
10,752 KB
testcase_04 AC 1,922 ms
10,880 KB
testcase_05 AC 1,884 ms
10,880 KB
testcase_06 AC 31 ms
10,624 KB
testcase_07 AC 69 ms
10,752 KB
testcase_08 AC 1,877 ms
10,624 KB
testcase_09 AC 1,911 ms
10,880 KB
testcase_10 AC 1,869 ms
10,880 KB
testcase_11 AC 1,871 ms
10,624 KB
testcase_12 AC 1,967 ms
10,624 KB
testcase_13 AC 29 ms
10,624 KB
testcase_14 AC 282 ms
10,624 KB
testcase_15 AC 245 ms
10,752 KB
testcase_16 AC 126 ms
10,752 KB
testcase_17 AC 98 ms
10,752 KB
testcase_18 AC 29 ms
10,624 KB
testcase_19 AC 34 ms
10,624 KB
testcase_20 AC 42 ms
10,624 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