結果

問題 No.1594 Three Classes
ユーザー O2MTO2MT
提出日時 2021-07-09 21:37:48
言語 PyPy3
(7.3.8)
結果
AC  
実行時間 190 ms / 2,000 ms
コード長 328 bytes
コンパイル時間 278 ms
使用メモリ 81,312 KB
最終ジャッジ日時 2022-12-17 01:42:21
合計ジャッジ時間 4,412 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 190 ms
81,312 KB
testcase_01 AC 86 ms
75,536 KB
testcase_02 AC 85 ms
75,768 KB
testcase_03 AC 99 ms
80,884 KB
testcase_04 AC 187 ms
81,140 KB
testcase_05 AC 188 ms
81,300 KB
testcase_06 AC 93 ms
80,876 KB
testcase_07 AC 95 ms
80,748 KB
testcase_08 AC 185 ms
81,148 KB
testcase_09 AC 186 ms
81,136 KB
testcase_10 AC 186 ms
81,148 KB
testcase_11 AC 186 ms
81,148 KB
testcase_12 AC 185 ms
81,272 KB
testcase_13 AC 85 ms
75,776 KB
testcase_14 AC 106 ms
81,200 KB
testcase_15 AC 105 ms
80,988 KB
testcase_16 AC 99 ms
80,884 KB
testcase_17 AC 98 ms
80,852 KB
testcase_18 AC 84 ms
75,560 KB
testcase_19 AC 95 ms
80,932 KB
testcase_20 AC 94 ms
80,728 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import product

N = int(input())
E = list(map(int,input().split()))
ans = 'No'
for nums in product(range(3),repeat=N):
  A,B,C = 0,0,0
  for i in range(N):
    if nums[i] == 0:
      A += E[i]
    elif nums[i] == 1:
      B += E[i]
    else:
      C += E[i]
  if A == B == C:
    ans = 'Yes'
    break

print(ans)
0