結果

問題 No.1594 Three Classes
ユーザー wolgnikwolgnik
提出日時 2021-07-09 21:47:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 49 ms / 2,000 ms
コード長 384 bytes
コンパイル時間 144 ms
コンパイル使用メモリ 82,308 KB
実行使用メモリ 61,696 KB
最終ジャッジ日時 2024-04-28 00:07:37
合計ジャッジ時間 1,720 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
61,440 KB
testcase_01 AC 37 ms
52,224 KB
testcase_02 AC 37 ms
52,352 KB
testcase_03 AC 47 ms
61,312 KB
testcase_04 AC 47 ms
61,056 KB
testcase_05 AC 47 ms
61,056 KB
testcase_06 AC 49 ms
61,440 KB
testcase_07 AC 45 ms
61,184 KB
testcase_08 AC 45 ms
61,128 KB
testcase_09 AC 45 ms
61,056 KB
testcase_10 AC 46 ms
61,056 KB
testcase_11 AC 46 ms
61,696 KB
testcase_12 AC 46 ms
61,184 KB
testcase_13 AC 35 ms
52,224 KB
testcase_14 AC 45 ms
61,696 KB
testcase_15 AC 48 ms
61,568 KB
testcase_16 AC 47 ms
61,312 KB
testcase_17 AC 47 ms
61,440 KB
testcase_18 AC 36 ms
52,480 KB
testcase_19 AC 38 ms
57,856 KB
testcase_20 AC 45 ms
60,776 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
table = [0] * (1 << N)

for t in range(1 << N):
  for i in range(N):
    if t & (1 << i): table[t] += a[i]

for t in range(1 << N):
  p = table[-1] - table[t]
  tt = t
  while tt:
    if table[t] - table[tt] == table[tt] == p:
      print("Yes")
      exit(0)
    tt = (tt - 1) & t
print("No")
0