結果

問題 No.1594 Three Classes
ユーザー kaitef
提出日時 2021-07-10 11:43:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 329 ms / 2,000 ms
コード長 401 bytes
コンパイル時間 177 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 157,092 KB
最終ジャッジ日時 2024-11-16 08:26:28
合計ジャッジ時間 5,392 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools
n=int(input())
e=list(map(int,input().split()))
l=["a","b","c"]
h_list = list(itertools.product(l, repeat=n))
for h in h_list:
    a=0
    b=0
    c=0
    for i in range(n):
        if h[i]=="a":
            a+=e[i]
        elif h[i]=="b":
            b+=e[i]
        else:
            c+=e[i]
    #print(a,b,c,h)
    if a==b and b==c:
        print("Yes")
        exit()

print("No")
0