結果

問題 No.1594 Three Classes
ユーザー shotoyooshotoyoo
提出日時 2021-07-09 21:25:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 119 ms / 2,000 ms
コード長 470 bytes
コンパイル時間 301 ms
コンパイル使用メモリ 87,008 KB
実行使用メモリ 77,080 KB
最終ジャッジ日時 2023-08-10 06:34:23
合計ジャッジ時間 3,197 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
77,080 KB
testcase_01 AC 68 ms
71,440 KB
testcase_02 AC 69 ms
71,488 KB
testcase_03 AC 74 ms
76,696 KB
testcase_04 AC 117 ms
76,952 KB
testcase_05 AC 118 ms
76,916 KB
testcase_06 AC 73 ms
76,536 KB
testcase_07 AC 74 ms
76,788 KB
testcase_08 AC 117 ms
76,780 KB
testcase_09 AC 116 ms
76,724 KB
testcase_10 AC 118 ms
76,980 KB
testcase_11 AC 118 ms
76,912 KB
testcase_12 AC 119 ms
76,956 KB
testcase_13 AC 67 ms
71,568 KB
testcase_14 AC 84 ms
77,024 KB
testcase_15 AC 79 ms
76,536 KB
testcase_16 AC 76 ms
76,552 KB
testcase_17 AC 73 ms
76,540 KB
testcase_18 AC 68 ms
71,452 KB
testcase_19 AC 73 ms
76,720 KB
testcase_20 AC 73 ms
76,612 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