結果

問題 No.1594 Three Classes
ユーザー norioc
提出日時 2021-07-10 05:05:58
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 434 bytes
コンパイル時間 225 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-07-02 00:38:24
合計ジャッジ時間 21,464 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10 TLE * 8
権限があれば一括ダウンロードができます

ソースコード

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