結果

問題 No.1594 Three Classes
ユーザー noriocnorioc
提出日時 2021-07-10 05:05:58
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 434 bytes
コンパイル時間 80 ms
コンパイル使用メモリ 10,968 KB
実行使用メモリ 12,696 KB
最終ジャッジ日時 2023-09-14 17:31:05
合計ジャッジ時間 12,574 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 AC 16 ms
7,808 KB
testcase_02 AC 16 ms
7,856 KB
testcase_03 AC 57 ms
7,928 KB
testcase_04 TLE -
testcase_05 TLE -
testcase_06 AC 57 ms
7,860 KB
testcase_07 AC 105 ms
7,800 KB
testcase_08 TLE -
testcase_09 TLE -
testcase_10 TLE -
testcase_11 TLE -
testcase_12 TLE -
testcase_13 AC 17 ms
7,872 KB
testcase_14 AC 465 ms
7,804 KB
testcase_15 AC 253 ms
7,808 KB
testcase_16 AC 138 ms
7,804 KB
testcase_17 AC 92 ms
7,784 KB
testcase_18 AC 16 ms
7,816 KB
testcase_19 AC 22 ms
7,980 KB
testcase_20 AC 30 ms
7,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def bits(p, n):
    a = [0] * n
    for i in range(pow(p, n)):
        x = i
        for j in range(n):
            a[j] = x % p
            x //= p
        yield a

input()
a = list(map(int, input().split()))

ok = False
b = [0, 0, 0]
for es in bits(3, len(a)):
    b[0] = b[1] = b[2] = 0
    for i in range(len(a)):
        b[es[i]] += a[i]
    if b[0] == b[1] == b[2]:
        ok = True
        break

print('Yes' if ok else 'No')
0