結果

問題 No.1594 Three Classes
ユーザー shotoyooshotoyoo
提出日時 2021-07-09 21:25:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 97 ms / 2,000 ms
コード長 470 bytes
コンパイル時間 168 ms
コンパイル使用メモリ 82,344 KB
実行使用メモリ 75,860 KB
最終ジャッジ日時 2024-04-27 23:52:18
合計ジャッジ時間 2,403 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
75,860 KB
testcase_01 AC 40 ms
51,968 KB
testcase_02 AC 37 ms
51,712 KB
testcase_03 AC 45 ms
60,288 KB
testcase_04 AC 92 ms
75,648 KB
testcase_05 AC 94 ms
75,628 KB
testcase_06 AC 47 ms
60,416 KB
testcase_07 AC 47 ms
62,208 KB
testcase_08 AC 97 ms
75,392 KB
testcase_09 AC 95 ms
75,360 KB
testcase_10 AC 96 ms
75,520 KB
testcase_11 AC 92 ms
75,520 KB
testcase_12 AC 94 ms
75,392 KB
testcase_13 AC 39 ms
51,968 KB
testcase_14 AC 56 ms
73,668 KB
testcase_15 AC 51 ms
67,328 KB
testcase_16 AC 47 ms
63,360 KB
testcase_17 AC 47 ms
61,952 KB
testcase_18 AC 39 ms
52,224 KB
testcase_19 AC 46 ms
59,904 KB
testcase_20 AC 45 ms
60,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda : sys.stdin.readline().rstrip()

sys.setrecursionlimit(2*10**5+10)
write = lambda x: sys.stdout.write(x+"\n")
debug = lambda x: sys.stderr.write(x+"\n")
writef = lambda x: print("{:.12f}".format(x))


n = int(input())
a = list(map(int, input().split()))
for b in range(3**n):
    v = 3
    l = [0]*3
    for i in range(n):
        l[b%v] += a[i]
        b = b//3
    if l[0]==l[1]==l[2]:
        print("Yes")
        break
else:
    print("No")
0