結果

問題 No.1463 Hungry Kanten
ユーザー mesame3993mesame3993
提出日時 2021-11-19 16:13:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 342 ms / 2,000 ms
コード長 401 bytes
コンパイル時間 503 ms
コンパイル使用メモリ 87,212 KB
実行使用メモリ 119,824 KB
最終ジャッジ日時 2023-08-30 00:02:32
合計ジャッジ時間 4,802 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,324 KB
testcase_01 AC 72 ms
71,276 KB
testcase_02 AC 111 ms
77,108 KB
testcase_03 AC 212 ms
76,792 KB
testcase_04 AC 84 ms
76,476 KB
testcase_05 AC 342 ms
119,824 KB
testcase_06 AC 72 ms
71,080 KB
testcase_07 AC 74 ms
71,324 KB
testcase_08 AC 74 ms
71,380 KB
testcase_09 AC 71 ms
71,328 KB
testcase_10 AC 78 ms
76,188 KB
testcase_11 AC 78 ms
76,492 KB
testcase_12 AC 80 ms
76,672 KB
testcase_13 AC 82 ms
76,608 KB
testcase_14 AC 87 ms
76,468 KB
testcase_15 AC 86 ms
76,616 KB
testcase_16 AC 89 ms
77,480 KB
testcase_17 AC 103 ms
80,016 KB
testcase_18 AC 108 ms
77,496 KB
testcase_19 AC 181 ms
93,024 KB
testcase_20 AC 268 ms
103,484 KB
testcase_21 AC 79 ms
76,204 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
  from sys import stdin
  readline=stdin.readline
  n, k = map(int, readline().split())
  A = list(map(int, readline().split()))
  ans = set()
  for i in range(2**n):
    wa, seki = 0, 1
    cnt = 0
    for j in range(n):
      if (i>>j) & 1:
        cnt += 1
        wa += A[j]
        seki *= A[j]
    if cnt < k:
      continue
    ans.add(wa)
    ans.add(seki)
  print(len(ans))
main()
0