結果

問題 No.1701 half price
ユーザー lllllll88938494lllllll88938494
提出日時 2022-09-12 20:48:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 609 ms / 3,000 ms
コード長 546 bytes
コンパイル時間 442 ms
コンパイル使用メモリ 81,968 KB
実行使用メモリ 76,224 KB
最終ジャッジ日時 2024-05-07 07:15:31
合計ジャッジ時間 4,038 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
52,964 KB
testcase_01 AC 44 ms
60,364 KB
testcase_02 AC 118 ms
76,224 KB
testcase_03 AC 39 ms
53,088 KB
testcase_04 AC 104 ms
75,876 KB
testcase_05 AC 49 ms
62,136 KB
testcase_06 AC 609 ms
76,004 KB
testcase_07 AC 602 ms
75,980 KB
testcase_08 AC 39 ms
52,616 KB
testcase_09 AC 43 ms
58,872 KB
testcase_10 AC 38 ms
52,404 KB
testcase_11 AC 38 ms
53,160 KB
testcase_12 AC 39 ms
52,932 KB
testcase_13 AC 39 ms
53,564 KB
testcase_14 AC 40 ms
53,564 KB
testcase_15 AC 44 ms
60,488 KB
testcase_16 AC 39 ms
53,424 KB
testcase_17 AC 52 ms
64,344 KB
testcase_18 AC 40 ms
52,744 KB
testcase_19 AC 52 ms
60,392 KB
testcase_20 AC 40 ms
52,560 KB
testcase_21 AC 605 ms
76,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import product
n,w=map(int,input().split())
a=list(map(int,input().split()))
ans=0

for i in product([0,1],repeat=n):
    t=i.count(1)
    if t == 0:
        continue
    for j in product([0,1],repeat=t):
        indj=0
        cntw=0
        for k in range(n):
            if i[k] == 1:
                if j[indj] == 1:
                    cntw += a[k]//2
                else:
                    cntw += a[k]
                indj+=1
        
        if cntw == w:
            ans+=1
            break
                
print(ans)
0