結果

問題 No.1594 Three Classes
ユーザー SidewaysOwlSidewaysOwl
提出日時 2021-07-09 22:06:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 364 ms / 2,000 ms
コード長 346 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 87,056 KB
実行使用メモリ 81,812 KB
最終ジャッジ日時 2023-08-10 06:51:27
合計ジャッジ時間 6,739 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 303 ms
79,868 KB
testcase_01 AC 69 ms
71,388 KB
testcase_02 AC 67 ms
71,456 KB
testcase_03 AC 357 ms
81,704 KB
testcase_04 AC 292 ms
79,908 KB
testcase_05 AC 296 ms
79,948 KB
testcase_06 AC 338 ms
79,312 KB
testcase_07 AC 352 ms
81,188 KB
testcase_08 AC 293 ms
79,608 KB
testcase_09 AC 290 ms
79,816 KB
testcase_10 AC 291 ms
79,696 KB
testcase_11 AC 295 ms
79,936 KB
testcase_12 AC 300 ms
79,736 KB
testcase_13 AC 82 ms
76,352 KB
testcase_14 AC 342 ms
80,544 KB
testcase_15 AC 364 ms
81,812 KB
testcase_16 AC 249 ms
80,600 KB
testcase_17 AC 326 ms
81,188 KB
testcase_18 AC 73 ms
75,196 KB
testcase_19 AC 88 ms
76,940 KB
testcase_20 AC 140 ms
79,228 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
e = list(map(int,input().split()))
ans = "No"
def dfs(k,l):
    global ans,n
    if k == n:
        if sum(l[0]) == sum(l[1]) == sum(l[2]):
            ans = "Yes"
        return
    for i in [0,1,2]:
        l[i][k] += e[k]
        dfs(k + 1,l[::])
        l[i][k] -= e[k]
l = [[0] * n for _ in range(3)]
dfs(0,l[::])
print(ans)
0