結果

問題 No.1594 Three Classes
コンテスト
ユーザー m1k__
提出日時 2021-07-10 02:30:08
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 74 ms / 2,000 ms
コード長 290 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 221 ms
コンパイル使用メモリ 85,120 KB
実行使用メモリ 79,872 KB
最終ジャッジ日時 2026-05-11 13:57:47
合計ジャッジ時間 2,188 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N = int(input())
A = [int(x) for x in input().split()]
def dfs(i, a, b, c):
    if i==N: 
        if a==b and b==c:
            print('Yes')
            exit()
    else:
        dfs(i+1, a+A[i], b, c)
        dfs(i+1, a, b+A[i], c)
        dfs(i+1, a, b, c+A[i])
dfs(0, 0, 0, 0)
print('No')
0