結果

問題 No.1594 Three Classes
ユーザー dango
提出日時 2023-07-14 18:59:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 85 ms / 2,000 ms
コード長 354 bytes
コンパイル時間 236 ms
コンパイル使用メモリ 81,664 KB
実行使用メモリ 75,648 KB
最終ジャッジ日時 2024-09-16 03:54:43
合計ジャッジ時間 2,353 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    n = int(input())
    a = list(map(int, input().split()))
    ans = False
    for id in range(3 ** n):
        i = id
        arr = [0] * 3
        for j in range(n):
            arr[i % 3] += a[j]
            i //= 3
        if arr[0] == arr[1] == arr[2]:
            ans = True
            break
    print("Yes" if ans else "No")
main()
0