結果

問題 No.1594 Three Classes
ユーザー wolgnikwolgnik
提出日時 2021-07-09 21:47:20
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 78 ms / 2,000 ms
コード長 384 bytes
コンパイル時間 330 ms
コンパイル使用メモリ 87,024 KB
実行使用メモリ 76,668 KB
最終ジャッジ日時 2023-08-10 06:49:30
合計ジャッジ時間 3,119 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
76,504 KB
testcase_01 AC 67 ms
71,396 KB
testcase_02 AC 66 ms
71,312 KB
testcase_03 AC 76 ms
76,192 KB
testcase_04 AC 77 ms
76,336 KB
testcase_05 AC 78 ms
76,352 KB
testcase_06 AC 77 ms
76,336 KB
testcase_07 AC 78 ms
76,320 KB
testcase_08 AC 74 ms
76,436 KB
testcase_09 AC 75 ms
76,444 KB
testcase_10 AC 78 ms
76,512 KB
testcase_11 AC 74 ms
76,504 KB
testcase_12 AC 76 ms
76,668 KB
testcase_13 AC 67 ms
71,344 KB
testcase_14 AC 76 ms
76,516 KB
testcase_15 AC 75 ms
76,332 KB
testcase_16 AC 74 ms
76,520 KB
testcase_17 AC 73 ms
76,608 KB
testcase_18 AC 66 ms
71,036 KB
testcase_19 AC 70 ms
75,672 KB
testcase_20 AC 74 ms
76,596 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