結果

問題 No.1701 half price
ユーザー lllllll88938494lllllll88938494
提出日時 2022-09-12 20:44:38
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 506 bytes
コンパイル時間 277 ms
コンパイル使用メモリ 87,240 KB
実行使用メモリ 77,060 KB
最終ジャッジ日時 2023-08-19 23:54:08
合計ジャッジ時間 4,797 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
71,300 KB
testcase_01 AC 69 ms
75,888 KB
testcase_02 AC 160 ms
77,060 KB
testcase_03 AC 69 ms
71,524 KB
testcase_04 AC 124 ms
76,836 KB
testcase_05 AC 78 ms
76,500 KB
testcase_06 AC 632 ms
76,984 KB
testcase_07 AC 629 ms
77,040 KB
testcase_08 WA -
testcase_09 AC 75 ms
76,216 KB
testcase_10 AC 66 ms
71,484 KB
testcase_11 AC 70 ms
71,344 KB
testcase_12 AC 70 ms
71,528 KB
testcase_13 AC 70 ms
71,528 KB
testcase_14 AC 68 ms
71,052 KB
testcase_15 AC 71 ms
76,420 KB
testcase_16 AC 68 ms
71,176 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 67 ms
71,520 KB
testcase_21 AC 591 ms
76,776 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):
    for j in product([0,1],repeat=i.count(1)):
        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