結果

問題 No.1463 Hungry Kanten
ユーザー y61mpnly61mpnl
提出日時 2021-04-02 21:31:07
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 351 bytes
コンパイル時間 254 ms
コンパイル使用メモリ 10,984 KB
実行使用メモリ 28,600 KB
最終ジャッジ日時 2023-08-25 14:48:06
合計ジャッジ時間 10,871 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,000 KB
testcase_01 AC 15 ms
8,004 KB
testcase_02 AC 130 ms
8,844 KB
testcase_03 TLE -
testcase_04 AC 28 ms
7,840 KB
testcase_05 TLE -
testcase_06 AC 15 ms
7,848 KB
testcase_07 AC 16 ms
7,868 KB
testcase_08 AC 16 ms
7,856 KB
testcase_09 AC 16 ms
7,844 KB
testcase_10 AC 17 ms
7,828 KB
testcase_11 AC 19 ms
7,812 KB
testcase_12 AC 22 ms
8,224 KB
testcase_13 AC 28 ms
7,796 KB
testcase_14 AC 42 ms
8,428 KB
testcase_15 AC 68 ms
7,764 KB
testcase_16 AC 131 ms
9,196 KB
testcase_17 AC 267 ms
11,592 KB
testcase_18 AC 512 ms
9,024 KB
testcase_19 AC 1,120 ms
18,352 KB
testcase_20 TLE -
testcase_21 AC 18 ms
7,764 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
a = list(map(int, input().split()))

st = set()
for i in range(1<<n):
	tmp = cnt = 0
	for j in range(n):
		if (i>>j)&1:
			tmp += a[j]
			cnt += 1
	if cnt>=k:
		st.add(tmp)

for i in range(1<<n):
	tmp = 1
	cnt = 0
	for j in range(n):
		if (i>>j)&1:
			tmp *= a[j]
			cnt += 1
	if cnt>=k:
		st.add(tmp)

print(len(st))
0