結果

問題 No.1594 Three Classes
ユーザー lemon
提出日時 2021-07-10 00:11:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 173 ms / 2,000 ms
コード長 637 bytes
コンパイル時間 577 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 75,904 KB
最終ジャッジ日時 2024-11-16 08:22:28
合計ジャッジ時間 3,009 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10 ** 6)
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()
nsa = lambda: list(map(str, stdin.readline().split()))
ntp = lambda: tuple(map(int, stdin.readline().split()))
mod = 10 ** 9 + 7
inf = 10 ** 18

n = ni()
E = na()

ans = 'No'
for i in range(3 ** n):
    a, b, c = 0, 0, 0
    for j in range(n):
        if i % 3 == 0:
            a += E[j]
        if i % 3 == 1:
            b += E[j]
        if i % 3 == 2:
            c += E[j]
        i //= 3
    if a == b == c:
        ans = 'Yes'
        break

print(ans)
0