結果

問題 No.1594 Three Classes
ユーザー kaitefkaitef
提出日時 2021-07-10 11:43:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 315 ms / 2,000 ms
コード長 401 bytes
コンパイル時間 160 ms
コンパイル使用メモリ 82,400 KB
実行使用メモリ 157,088 KB
最終ジャッジ日時 2024-04-28 00:37:38
合計ジャッジ時間 4,928 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 292 ms
156,824 KB
testcase_01 AC 34 ms
53,136 KB
testcase_02 AC 37 ms
52,756 KB
testcase_03 AC 184 ms
156,832 KB
testcase_04 AC 311 ms
156,736 KB
testcase_05 AC 315 ms
157,060 KB
testcase_06 AC 192 ms
156,960 KB
testcase_07 AC 194 ms
156,932 KB
testcase_08 AC 298 ms
156,620 KB
testcase_09 AC 294 ms
156,844 KB
testcase_10 AC 297 ms
156,828 KB
testcase_11 AC 294 ms
156,568 KB
testcase_12 AC 296 ms
156,964 KB
testcase_13 AC 34 ms
52,752 KB
testcase_14 AC 197 ms
157,044 KB
testcase_15 AC 194 ms
156,960 KB
testcase_16 AC 87 ms
99,424 KB
testcase_17 AC 189 ms
157,088 KB
testcase_18 AC 33 ms
52,532 KB
testcase_19 AC 42 ms
63,456 KB
testcase_20 AC 43 ms
64,548 KB
権限があれば一括ダウンロードができます

ソースコード

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