結果

問題 No.1594 Three Classes
ユーザー noriocnorioc
提出日時 2021-07-10 05:03:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 303 ms / 2,000 ms
コード長 411 bytes
コンパイル時間 143 ms
コンパイル使用メモリ 82,212 KB
実行使用メモリ 76,032 KB
最終ジャッジ日時 2024-04-28 00:35:50
合計ジャッジ時間 4,391 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 298 ms
75,996 KB
testcase_01 AC 38 ms
51,968 KB
testcase_02 AC 40 ms
52,224 KB
testcase_03 AC 56 ms
67,456 KB
testcase_04 AC 296 ms
75,776 KB
testcase_05 AC 303 ms
76,032 KB
testcase_06 AC 55 ms
68,160 KB
testcase_07 AC 74 ms
75,904 KB
testcase_08 AC 302 ms
76,020 KB
testcase_09 AC 298 ms
75,872 KB
testcase_10 AC 297 ms
75,756 KB
testcase_11 AC 297 ms
75,680 KB
testcase_12 AC 290 ms
75,520 KB
testcase_13 AC 39 ms
51,712 KB
testcase_14 AC 102 ms
75,776 KB
testcase_15 AC 82 ms
75,776 KB
testcase_16 AC 67 ms
75,904 KB
testcase_17 AC 58 ms
73,892 KB
testcase_18 AC 38 ms
52,224 KB
testcase_19 AC 51 ms
61,952 KB
testcase_20 AC 48 ms
63,104 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
for es in bits(3, len(a)):
    b = [0, 0, 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